VB6调用VC的 DLL传字符串总是不全,求救
DLL 声明BOOL WINAPI GPNetSend(char *databuf,int len)
VB声明
Public Declare Function GPNetSend Lib "GPnetIO" (ByVal databuf As String, ByVal charlen As Long) As Long
dim texttest as string
dim SendArr() as byte
texttest = "C2 D2 EF FB F1 1B 64 06"
outputLen = strHexToByteArray(texttest, SendArr) '将字符串转成byte()数组 长度为:outputLen=8
sendbuf = StrConv(SendArr, vbUnicode) ‘转成unicode
GPsendflag = GPNetSend(sendbuf, outputLen) 发送到网口端口
网口端口接收到的是:C2 D2 EF FB 3F 64 06 00
为什么会乱呢!搞了一天都不行。 --------------------编程问答-------------------- Public Declare Function GPNetSend Lib "GPnetIO" (ByRef databuf As Byte, ByVal charlen As Long) As Long
dim texttest as string
dim SendArr() as byte
outputLen = strHexToByteArray(texttest, SendArr)
GPsendflag = GPNetSend(SendArr(0), outputLen) 发送到网口端口
补充:VB , 网络编程