【已解决】请问如何捕捉特定按键动作并计数?
本帖最后由 dhwc 于 2011-12-27 09:12 编辑请问AU3怎样才能捕捉特定按键(比如A键)的击键动作并计数?
恳请指教,谢谢 通过_IsPressed函数,检查按键是否按下,具体看手册 本帖最后由 menfan1 于 2011-12-24 11:25 编辑
看帮助哈。。呵呵,自己判断加计数器哈
#include <Misc.au3>
Local $hDLL = DllOpen("user32.dll")
While 1
If _IsPressed("10", $hDLL) Then
ConsoleWrite("_IsPressed - Shift Key was pressed." & @CRLF)
; 一直等待,直到按键被释放
While _IsPressed("10", $hDLL)
Sleep(250)
WEnd
ConsoleWrite("_IsPressed - Shift Key was released." & @CRLF)
ElseIf _IsPressed("1B", $hDLL) Then
MsgBox(0, "_IsPressed", "The Esc Key was pressed, therefore we will close the application.")
ExitLoop
EndIf
Sleep(250)
WEnd
DllClose($hDLL) 谢谢了兄弟!
页:
[1]