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

解决方案 »

  1.   

    没用过PB,不过印象中PB的语句和VB差不多吧。
    你直接贴过去看是哪里出错再改吧
      

  2.   

    Declare   Function   Get_Keypad_Buffer   Lib   "PINPAD.dll"   (ByRef   buf   As   Byte,   ByRef   lengb   As   Long)   As   Long 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   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 
      

  3.   

    API声明有一些不一样,你可以参考Function long Get_Keypad_Buffer  lib 'user32'   ( ref char buf, ref long  lengb )  as long变量定义时long keylen 
    string str
    integer i..差别不是很大