VC的DLL怎么传出结构体给VB
VC:typedefstruct_INFO{inta;intb;intc;}INFO,*PINFO,*LPINFO;void_stdcallOUTPUT(LPTRNINF...
VC:
typedef struct _INFO
{
int a;
int b;
int c;
}INFO,*PINFO,*LPINFO;
void _stdcall OUTPUT(LPTRNINFO ret) //DLL导出函数
{
INFO n;
n.a = 10;
n.b = 20;
n.c = 30;
CopyMemory(ret,&n,sizeof(n));
}
VB:
Private Declare Function Fun Lib "TestDLL" (ret As INFO) As Long
Pprivate Type INFO
a As Long
b As Long
c As Long
End Type
Private Sub Form_Load()
Dim a as INFO
Fun a
MsgBox a.a
MsgBox a.b
MsgBox a.c
End Sub
为什么传出来的a.a有数据,a.b以后的结构体成员就都是0了呢?
求解决办法。 展开
typedef struct _INFO
{
int a;
int b;
int c;
}INFO,*PINFO,*LPINFO;
void _stdcall OUTPUT(LPTRNINFO ret) //DLL导出函数
{
INFO n;
n.a = 10;
n.b = 20;
n.c = 30;
CopyMemory(ret,&n,sizeof(n));
}
VB:
Private Declare Function Fun Lib "TestDLL" (ret As INFO) As Long
Pprivate Type INFO
a As Long
b As Long
c As Long
End Type
Private Sub Form_Load()
Dim a as INFO
Fun a
MsgBox a.a
MsgBox a.b
MsgBox a.c
End Sub
为什么传出来的a.a有数据,a.b以后的结构体成员就都是0了呢?
求解决办法。 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询