长按键..
怎样实现对一个键(如)的长按(不是send的ALT&CTRL等)另外_Ispressed函数能检测该键是否被长按中吗?谢谢 send 一个键down就是对其长按
_Ispressed函数只能检测某键是否被按下,只用它不用测出时间长短的 这要看多久时间算长按了。#include <Misc.au3>
Global $time = 0
HotKeySet("{ESC}", "quit")
While 1
If _IsPressed(55) = 1 Then
While 1
If _IsPressed(55) <> 1 Then
$time = 0
ExitLoop
EndIf
If $time = 3 Then
ToolTip("")
MsgBox(0, 0,"U键长按了3秒")
ExitLoop
EndIf
Sleep(1000)
$time += 1
ToolTip("U 键按了 "& $time &" 秒,按ESC键退出")
WEnd
EndIf
ToolTip("长按 U 键测试,按ESC键退出")
WEnd
Func quit()
Exit
EndFunc thanks!!! good example.....
页:
[1]