vb.net调用三方dll api出现PInvoke问题,请教各位大师....
使用vb.net调用一个三方dll,原三方dll的demo是用vb6写的,里面定义了一个type:
Public Type SERVICE_Package
a(10) As Byte
b(12) As Byte
c(3) As Byte
d As Byte
e(200) As Byte
f As Byte
g(200) As Byte
End Type
我在vb.net中写了一个Structure,和VB6中的type一致:
Public Structure Service_Package
Dim a() As Byte
Dim b() As Byte
Dim c() As Byte
Dim d As Byte
Dim e() As Byte
Dim f As Byte
Dim g() As Byte
Public Sub Initialize()
Redim a(10)
Redim b(12)
Redim c(3)
Redim e(200)
Redim g(200)
End Structure
引入DLL的命令:
Public Declare Function RecvPackage Lib "WPDAPI.dll" _
() As Service_Package
测试的时候,一直报错“方法的类型签名与 PInvoke 不兼容”,在网上查了些资料,也看了部分P/INVOKE资料,估计是P/Invoke返回的是指针所致,不过实在是没找到解决办法,求教各位大虾,是否有好的解决办法??