首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

在VB中怎样读取DLL中结构体中的数组?该如何处理

2012-05-27 
在VB中怎样读取DLL中结构体中的数组?sum.DLL中部份代码:自定义的结构体struct tData{inticountint*piRead

在VB中怎样读取DLL中结构体中的数组?
sum.DLL中部份代码:
自定义的结构体
struct tData 
{
inticount;
int*piReadBuf;
int*piReadLen;
};

void WINAPI test(tData *t)
{
int i, j = *t->piReadLen;
for (i = 0; i < j; i++)
{
t->piReadBuf[i] = (i + 1) + (t->icount);
}
}

VB中部份代码:
与DLL中相对应的结构体(在标准模块中定义的)
Type tdata
  i As Long
  ReadBuf(351) As Long
  ReadLen As Long
End Type

声明
Declare Sub test Lib "sum.dll" (tt As tdata)


Private Sub Command1_Click()
  Dim t As tdata

  t.icount = 10
  t.ReadLen = 352
  Call test(t)
   
  Print t.ReadBuf(20)
End Sub

为什么在VB中一运行,程序就挂掉呢?

[解决办法]
看看这个例子:

http://www.vbgood.com/thread-87054-3-1.html

热点排行