vb 调用DLL问题
dll内有以下函数:
int DecCard (int ComPort,int CardNumLength,unsigned char *CardNum,int DecMoney)
'入口参数:
' CardNumLength:显示卡号长度(字节数),最小可设置为10,最大可设置为17
' CardNum: 显示卡号(ASCII码),显示卡号长度等于CardNumLength
' DecMoney: 要扣除的金额
在vb中这样声明对吗?
Public Declare Function DecCard Lib "C:\WINDOWS\SYSTEM32\SmartCom411SFJ.dll" (ByVal ComPort As Long, ByVal CardNumLength As Long, ByRef CardNum As Byte, ByRef DecMoney As Long) As Long
Dim DecCardRuturn as Long
Dim CardNum() As Byte
DecMoney =Val(Text11.Text)
CardNum() = StrConv(Trim(Text3.Text) & vbNullChar, vbFromUnicode) ' 将字符串转换成字节数组
DecCardRuturn = SMT_DecCard(ComPort, CardNumLength, CardNum(0), DecMoney)
怎么老是操作不成功啊?请各位大虾指点指点!
[最优解释]
DecMoney =Clng(Text11.Text)
[其他解释]
Public Declare Function DecCard Lib "C:\WINDOWS\SYSTEM32\SmartCom411SFJ.dll" (ByVal ComPort As Long, ByVal CardNumLength As Long, ByRef CardNum As Byte, ByVal DecMoney As Long) As Long
Dim DecCardRuturn as Long
Dim CardNum() As Byte
DecMoney =Val(Text11.Text)
CardNum() = StrConv(Text3.Text & chr(0), vbFromUnicode) ' 将字符串转换成字节数组
DecCardRuturn = SMT_DecCard(ComPort, CardNumLength, CardNum(0), DecMoney)
Public Declare Function DecCard Lib "C:\WINDOWS\SYSTEM32\SmartCom411SFJ.dll" (ByVal ComPort As Long, ByVal CardNumLength As Long, ByRef CardNum As Byte, ByRef DecMoney As Long) As Long
Dim DecCardRuturn as Long
Dim CardNum() As Byte
DecMoney =Clng(Text11.Text)
CardNum() = StrConv(Text3.Text & chr(0), vbFromUnicode) ' 将字符串转换成字节数组
DecCardRuturn = SMT_DecCard(ComPort, CardNumLength, CardNum(0), DecMoney)