Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As IntegerPrivate Sub Form_Load() Timer1.Interval = 10 End SubPrivate Sub Timer1_Timer() Dim x As Long x = GetAsyncKeyState(1) '左键 If x = -32767 Then debug.print "左键" End Ifx = GetAsyncKeyState(2) '右键 If x = -32767 Then debug.print "右键" End If End Sub 或用钩子实现吧
Timer1.Interval = 10
End SubPrivate Sub Timer1_Timer()
Dim x As Long
x = GetAsyncKeyState(1) '左键
If x = -32767 Then
debug.print "左键"
End Ifx = GetAsyncKeyState(2) '右键
If x = -32767 Then
debug.print "右键"
End If
End Sub
或用钩子实现吧
http://dev.csdn.net/develop/article/31/31462.shtm
http://www.sijiqing.com/vbgood/forum/forum_posts.asp?TID=13586&PN=1
但是还是感谢各位的帮助!