Private Declare Function GetKeyState Lib"user32"(ByVal nVirtKey As Long) As Integer
Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (ByVal vKey As Long) As Integer
Dimenv AA, BB, CC, DD
Global zz
DO
If GetAsyncKeyState(17) = 32768 and GetKeyState(65) < 0 Then
TracePrint "你启动了线程A"
StopThread BB
StopThread CC
StopThread DD
AA = BeginThread(A)
Delay 1000
ElseIf GetAsyncKeyState(17) = 32768 and GetKeyState(66) < 0 Then
TracePrint "你启动了线程B"
StopThread AA
StopThread CC
StopThread DD
BB = BeginThread(B)
Delay 1000
ElseIf GetAsyncKeyState(17) = 32768 and GetKeyState(67) < 0 Then
TracePrint "你启动了线程C"
StopThread BB
StopThread AA
StopThread DD
CC = BeginThread(C)
Delay 1000
ElseIf GetAsyncKeyState(17) = 32768 and GetKeyState(68) < 0 Then
TracePrint "你启动了线程D"
StopThread BB
StopThread CC
StopThread AA
DD = BeginThread(D)
Delay 1000
End If
Loop
Sub A
Do
z = GetLastClick
If z = 32770 Then
TracePrint "你按下了左键A" & zz
zz = zz + 1
End If
Loop
End Sub
Sub B
Do
z = GetLastClick
If z = 32770 Then
TracePrint "你按下了左键B"&zz
zz = zz + 1
End If
Loop
End Sub
Sub C
Do
z = GetLastClick
If z = 32770 Then
TracePrint "你按下了左键C" & zz
zz = zz + 1
End If
Loop
End Sub
Sub D
Do
z = GetLastClick
If z = 32770 Then
TracePrint "你按下了左键D" & zz
zz = zz + 1
End If
Loop
End Sub
如果你只是需要一个基本启动判断那么用多个IF就行了,不过你需要运行子线程的情况下还能开关其他子线程那还是需要多线程的,这是一个简单的判断组合键启动关闭子线程的代码,定义的API函数有GetKeyState和GetAsyncKeyState,把你的脚本放入相对的子程序中就行了,也就是zz=zz+1可以换成你的自写脚本,zz这个变量只是用来计算左键按键的次数的,没有任何作用。
追问老哥牛逼!
我明天消化消化,有啥不懂的接着问你
顺便追点悬赏