vb 调用C写的dll 含结构体问题!大家帮我看看。
DLL int WINAPI JBC7K2_MifarePsw(_mifarepsw_ psw, char *ip, int port);/*
/*
函数说明:设置IC卡读卡密码.
参数:
_mifarepsw_ 请查看_mifarepsw_数据结构的定义.JBC7200只需要
设置一个扇区号和扇区密码.另外一个扇区号和密码只作备用.
返回值:
= 0 成功
< 0 失败
*/
其中mifarepsw结构体如下:
struct _mifarepsw_
{
int sector1,//IC卡扇区号
sector2;//IC卡扇区号
char psw1[6],//读IC卡扇区时所用的密码.
psw2[6];//读IC卡扇区时所用的密码.
};
*/
VB调用
Type AFEditPW
sector1 As Long
sector2 As Long
psw1(0 To 5) As Byte
psw2(0 To 5) As Byte
End Type
Public Declare Function JBC7K2_MifarePsw Lib "jbc7200.dll" (ByRef AFmifarepsw As AFEditPW, ByVal ip As String, ByVal port As Long) As Long
调用:
Dim i As Long
Dim s As String
Dim AFPw As AFEditPW
i = 5101
s = "192.168.0.111"
AFPw.sector1 = 11
AFPw.sector2 = 12
AFPw.psw1(0) = &HFF
AFPw.psw1(1) = &HFF
AFPw.psw1(2) = &HFF
AFPw.psw1(3) = &HFF
AFPw.psw1(4) = &HFF
AFPw.psw1(5) = &HFF
AFPw.psw2(0) = &HFF
AFPw.psw2(1) = &HFF
AFPw.psw2(2) = &HFF
AFPw.psw2(3) = &HFF
AFPw.psw2(4) = &HFF
AFPw.psw2(5) = &HFF
Text1.Text = JBC7K2_MifarePsw(AFPw, s, i)
不能通过,非法关闭
大家帮我看看啊,一运行就报错关闭 换成:Public Declare Function JBC7K2_MifarePsw Lib "jbc7200.dll" (byval AFmifarepsw As AFEditPW, ByVal ip As String, ByVal port As Long) As Long
提示未找到变量
没人回答啊,高手都潜伏了
补充:VB , 基础类