HotKeySet
设置一个可调用某用户函数的热键.
HotKeySet ( "热键" [, "函数名"] )
UDF函数
_IsPressed
检查一个按键是否被按下
#include <Misc.au3>
_IsPressed($sHexKey [, $vDLL = 'user32.dll'])
示例/演示#include <Misc.au3>
Local $hDLL = DllOpen("user32.dll")
While 1
If _IsPressed("02", $hDLL) Then
ConsoleWrite("_IsPressed - 鼠标右键 was pressed." & @CRLF)
; 一直等待,直到按键被释放
While _IsPressed("04", $hDLL)
Sleep(250)
WEnd
ConsoleWrite("_IsPressed - Shift Key was released." & @CRLF)
ElseIf _IsPressed("01", $hDLL) Then
MsgBox(4096, "_IsPressed", "The 鼠标左键 was pressed, therefore we will close the application.")
ExitLoop
EndIf
Sleep(250)
WEnd
DllClose($hDLL)
|