试下另类的办法.
$time=TimerInit()
HotKeySet("{Enter}", "test")
HotKeySet("{Esc}", "_Exit")
AdlibRegister("press_key",30*1000)
While 1
Sleep(100)
ToolTip(int(TimerDiff($time)/1000)&"秒")
WEnd
Func press_key()
AdlibUnRegister("press_key")
msgbox(0,0,"Time Over")
_run()
$time=TimerInit()
AdlibRegister("press_key",30*1000)
EndFunc
Func test()
AdlibUnRegister("press_key")
msgbox(0,0,"Pressed 'Enter' Key")
_run()
$time=TimerInit()
AdlibRegister("press_key",30*1000)
EndFunc
Func _run()
;这里是超时需要执行的代码
EndFunc
Func _Exit()
AdlibUnRegister("press_key")
Exit
EndFunc
|