Public Declare Function Get_Keypad_Buffer Lib "PINPAD.dll" (ByRef buf As Byte, ByRef lengb As Long) As LongPrivate Sub Command5_Click()
On Error GoTo err_process
Dim keybuf(0 To 511) As Byte
Dim keylen As Long
Dim str As String
Dim i As Integer
lngRet = Get_Keypad_Buffer(keybuf(0), keylen) '取得按键码
If Not lngRet Then
If keylen <> 0 Then
str = ""
For i = 0 To keylen - 1
str = str & " " & Right("0" & Hex(keybuf(i)), 2)
Next i
End If
Exit Sub
End If
err_process:
MsgBox "取得按键码失败!"
End Sub
你直接贴过去看是哪里出错再改吧
On Error GoTo err_process
Dim keybuf(0 To 511) As Byte
Dim keylen As Long
Dim str As String
Dim i As Integer
lngRet = Get_Keypad_Buffer(keybuf(0), keylen) '取得按键码
If IsFalse lngRet Then
If keylen <> 0 Then
str = ""
For i = 0 To keylen - 1
str = str & " " & Right$("0" & Hex$(keybuf(i)), 2)
Next i
End If
Exit Sub
End If
err_process:
MsgBox "取得按键码失败!"
End Sub
string str
integer i..差别不是很大