難得在知道上看到這麽有意思的題目,下面是我的代碼:
Declare?Function?GetAsyncKeyState?Lib?"user32"?Alias?"GetAsyncKeyState"?(ByVal?vKey?As?Long)?As?Integernowleft?=?0
While?1
If?GetAsyncKeyState(88)?<?0?and?nowleft=0?Then?
LeftDown?1
nowleft?=?1
ElseIf?GetAsyncKeyState(88)?>=0?and?nowleft=1?then
LeftUp?1
nowleft=0
End?If
Delay?50
Wend
裏面用到了windows提供的api:GetAsyncKeyState,檢測X鍵的狀態。
這段代碼完美的滿足了妳的要求,希望對妳有幫助!^o^