vc中函数定义如下:
int __stdcall WimDev_Data(int VelID,long *Weight,long *WtLimit,int AxisType[10],long AxisWeight[10],double *speed)我在vb中声明如下:
Declare Function WimDev_Data Lib "WtSys_Dll.dll" (ByVal carno As Long, ByRef weight As Long, ByRef wtlimit As Long, ByRef Axistype() As Long, ByRef Axisweight() As Long, ByRef speed As Long) As Long在程序中调用方式为
Dim ret
Dim weight As Long
Dim wtlimit As Long
Dim Axistype(1 To 10) As Long
Dim Axisweight(1 To 10) As Long
Dim speed As Long
ret = WimDev_Data(1, weight, wtlimit, Axistype, Axisweight, speed)weight,weight能够返回正确,可Axistype和Axisweight和speed返回都不对改为
ret = WimDev_Data(1, weight, wtlimit, Axistype(1), Axisweight(1), speed)
提示 类型不匹配,缺少数组请哪位高手看看到底该怎么调用?(dll没问题,在vc下返回正常),多谢
int __stdcall WimDev_Data(int VelID,long *Weight,long *WtLimit,int AxisType[10],long AxisWeight[10],double *speed)我在vb中声明如下:
Declare Function WimDev_Data Lib "WtSys_Dll.dll" (ByVal carno As Long, ByRef weight As Long, ByRef wtlimit As Long, ByRef Axistype() As Long, ByRef Axisweight() As Long, ByRef speed As Long) As Long在程序中调用方式为
Dim ret
Dim weight As Long
Dim wtlimit As Long
Dim Axistype(1 To 10) As Long
Dim Axisweight(1 To 10) As Long
Dim speed As Long
ret = WimDev_Data(1, weight, wtlimit, Axistype, Axisweight, speed)weight,weight能够返回正确,可Axistype和Axisweight和speed返回都不对改为
ret = WimDev_Data(1, weight, wtlimit, Axistype(1), Axisweight(1), speed)
提示 类型不匹配,缺少数组请哪位高手看看到底该怎么调用?(dll没问题,在vc下返回正常),多谢
在vb中使用把它当作指针即可。假如你怕越界访问可以将缓冲区的尺寸传进去
多谢回答!
可是dll中函数没有接收缓冲区的参数啊
Declare Function WimDev_Data Lib "WtSys_Dll.dll" (ByVal carno As Long, ByRef weight As Long, ByRef wtlimit As Long, ByRef Axistype As Long, ByRef Axisweight As Long, ByRef speed As Long) As Long
多谢你,好了给分撒