谁用过明华读写器提供的dll编写代码?我为什么读不出来0扇0块的序列号
Declare Function rf_init Lib "mwrf32.dll" (ByVal port%, ByVal baud As Long) As Long
Declare Function rf_authentication_2 Lib "mwrf32.dll" (ByVal icdev As Long, ByVal mode%, ByVal keynr%, ByVal Adr%) As Integer
Declare Function rf_card Lib "mwrf32.dll" (ByVal icdev As Long, ByVal mode%, Snr As Long) As Integer
Declare Function rf_read Lib "mwrf32.dll" (ByVal icdev As Long, ByVal Adr%, ByVal sdata$) As Integer
Private Sub Command1_Click()
Dim data32 As String * 32
If icdev < 0 Then
icdev = rf_init(0, 9600) 'Com1
End If
If icdev < 0 Then
Exit Sub
End If
Dim r As Integer
Dim f As Integer
Dim g As Integer
r = rf_card(icdev, 0, Snr)
Debug.Print "r=" & r'返回0正常
f = rf_authentication_2(icdev, 0, 0, 0)
Debug.Print "f=" & f'返回0正常
g = rf_read(icdev, 0, data32) '???data32 读出来是使乱码 不是6235a5d3210804006263646566676869
Debug.Print "g=" & g'返回0正常
quit
End Sub --------------------编程问答-------------------- 没用过,帮顶顶. --------------------编程问答--------------------
Up........ --------------------编程问答-------------------- 我用VC调用过,你可能是没有使用ascii方式。
--------------------编程问答-------------------- 别帮着顶,帮着分析一下原因
to:jennyvenus
我看看 :-( --------------------编程问答-------------------- 有谁帮助一下
g = rf_read(icdev, 0, data32) 能直接取出十六进制数而不是取字符 --------------------编程问答-------------------- 你不将函数声明以及详细文档贴出来,别人是不好帮你的。
--------------------编程问答-------------------- 试试, 看看它返回的究竟是什么:
Declare Function rf_read Lib "mwrf32.dll" (ByVal icdev As Long, ByVal Adr%, ByVal sdata As Byte) As Integer
Dim data32(32) As Byte
g = rf_read(icdev, 0, data32(0))
for i = 0 to 31
debug.print hex(data32(i))
next i --------------------编程问答-------------------- Declare Function rf_read Lib "mwrf32.dll" (ByVal icdev As Long, ByVal Adr%, ByVal sdata$) As Integer
楼主:这个函数的原型是什么样的?
我觉得第二个参数的类型很可能不正确!
这个 .dll 是哪种语言开发的?
--------------------编程问答--------------------
'???data32 读出来是使乱码 不是6235a5d3210804006263646566676869
应该是第三个参数的类型不对~ byval 改成byref试试
补充:VB , 基础类