dxjhq | 2009-03-15 03:22 | 怎么我转成VB就不行呀,请帮我看下 Private Sub Timer1_Timer() 'SendMessage pid, &H1, 0, 0 Dim lpaam As Long Dim key As Integer key = &H31 lParam = VKB_param(key, 1) PostMessage pid, WM_KEYDOWN, key, lParam lParam = VKB_param(key, 0) ' {松开键} PostMessage pid, WM_KEYUP, key, lParam 'keybd_event VK_3, 0, 0, 0 '按下7键 'keybd_event VK_1, 0, KEYEVENTF_KEYUP, 0 End Sub Function VKB_param(VirtualKey As Integer, flag As Integer) As Long ' //函数名 Dim s As String Dim Firstbyte As String Dim Secondbyte As String If flag = 1 Then '按下键 Firstbyte = "00" Else ' //弹起键 Firstbyte = "C0" End If S_code = MapVirtualKey(VirtualKey, 0) Secondbyte = "00" & S_code Secondbyte = Right(Secondbyte, 2) s = "&H" + Firstbyte + Secondbyte + "0001" 'Result:=strtoint(s); VKB_param = Val(s) End Function | |