Private Declare Sub GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (key As Long)
Do
If 获取按键状态(87) < 0 Then '按下
//TracePrint "按下"
ElseIf 获取按键状态(87) >= 0 Then'放开
//TracePrint "放开"
End If
Delay 50
Loop
Function 获取按键状态(键代码)'小于0 = 按下。 大于等于0 =放开
获取按键状态=GetAsyncKeyState(键代码)
End Function
简单点就这样