Declare Function GetKeyState Lib "user32" Alias "GetKeyState" (ByVal vKey As Long) As Integer
Dim Astat //定义状态记录变量
Astat = 0//赋初值, =0表示没有被按下
Global asas
While 1
n= GetKeyState(192) //A
If n<>Astat Then
Astat = n
If (n >= 0) Then
asas = 1
Else
asas = 0
线程ID=BeginThread(abc)
end if
End If
Wend
Sub abc
Do
LeftClick 1
Delay 300
RightClick 1
Delay 200
Loop Until asas=1
End sub