VB调用C++的DLL函数,参数是自定义结构体数组,如何传递
VB调用C++的DLL函数,参数是自定义结构体数组,这个参数是要输出的PrivateDeclareFunctionFunctionALib"A.DLL"(ByValobj...
VB调用C++的DLL函数,参数是自定义结构体数组,这个参数是要输出的
Private Declare Function FunctionA Lib "A.DLL" (ByVal objptr As Long, ByRef B As STRUCTA) As Integer
Private Type STRUCTA
ID(1 To 5) As Long
Num(1 To 6) As Long
End Type
我在VB里调用:
Dim INFO() As STRUCTA
str = FunctionA (longa, INFO)
这样语法会报错,说INFO和申明的类型不同
可是ByRef B As STRUCTA-〉ByVal B As STRUCTA又不可以,自定义只能ByRef 展开
Private Declare Function FunctionA Lib "A.DLL" (ByVal objptr As Long, ByRef B As STRUCTA) As Integer
Private Type STRUCTA
ID(1 To 5) As Long
Num(1 To 6) As Long
End Type
我在VB里调用:
Dim INFO() As STRUCTA
str = FunctionA (longa, INFO)
这样语法会报错,说INFO和申明的类型不同
可是ByRef B As STRUCTA-〉ByVal B As STRUCTA又不可以,自定义只能ByRef 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询