取消热键该怎么做?
请教一下各位大大,要取消定义的热键,该如何实现?举个例子
#include <GuiConstants.au3>
#NoTrayIcon
Global$user,$ok1
$begin= GUICreate("选择用户",160, 100)
$combo=GUICtrlCreateCombo("", 30, 10,100,20)
GUICtrlSetData(-1, "user1|user2","user1")
$ok = GUICtrlCreateButton("确定", 50, 70, 60, 20,0)
GUISetState(@SW_SHOW)
while 1
if WinActive("选择用户","")=1 Then
HotKeySet("{Esc}", "_esc")
HotKeySet("{ENTER}", "_ENTER1")
Else
EndIf
$user=GUICtrlRead($combo)
$msg = GUIGetMsg()
Select
Case $msg = $ok
_run($user)
case$msg = $GUI_EVENT_CLOSE
exit
EndSelect
WEnd
Func _run($user)
GUIDelete($begin)
$run= GUICreate("请按确定",160, 100)
$ok1 = GUICtrlCreateButton("确定", 50, 70, 60, 20,0)
GUISetState(@SW_SHOW)
while 1
if WinActive("请按确定","")=1 Then
HotKeySet("{Esc}", "_esc")
HotKeySet("{ENTER}", "_ENTER2")
Else
EndIf
$msg = GUIGetMsg()
Select
Case $msg = $ok1
msgbox(48,"显示","你选择的用户是"&$user)
case$msg = $GUI_EVENT_CLOSE
exit
EndSelect
wend
EndFunc
FUNC _esc()
exit
EndFunc
FUNC _enter1()
$msg=$ok
EndFunc
FUNC _enter2()
EndFunc
在这个脚本里,我想实现,当脚本的窗口激活时,热键生效,脚本窗口非激活时,释放热键...这个该怎么做呢?
[ 本帖最后由 palkiller 于 2008-9-24 09:19 编辑 ] Do
check()
WinWait("请按确定")
HotKeySet("{Esc}", "_esc")
HotKeySet("{ENTER}", "_ENTER2")
Exit
Func check()
if WinWait("请按确定")=0 then Return
EndFunc 原帖由 l4ever 于 2008-9-22 16:19 发表 http://www.autoitx.com/images/common/back.gif
Do
check()
WinWait("请按确定")
HotKeySet("{Esc}", "_esc")
HotKeySet("{ENTER}", "_ENTER2")
Exit
Func check()
if WinWait("请按确定")=0 then Return
EndFunc
谢谢LS的回复...试了下,貌似还不行,脚本是暂停了...但是热键还是没有释放出来...-_-|||
[ 本帖最后由 palkiller 于 2008-9-23 08:56 编辑 ] 楼主的逻辑很混乱,我不知道你想干什么!
关于热键只在指定窗口有效的,我给个例子
#include <GuiConstants.au3>
#NoTrayIcon
HotKeySet("{ENTER}", "_ENTER1")
Global $user, $ok1
$begin = GUICreate("选择用户", 160, 100)
$combo = GUICtrlCreateCombo("", 30, 10, 100, 20)
GUICtrlSetData(-1, "user1|user2", "user1")
$ok = GUICtrlCreateButton("确定", 50, 70, 60, 20, 0)
GUISetState(@SW_SHOW)
While 1
$user = GUICtrlRead($combo)
$msg = GUIGetMsg()
Select
Case $msg = $ok
;_run($user)
Case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
Func _ENTER1()
if WinGetTitle("")="选择用户" Then
MsgBox(0,"测试",'当前窗口为"选择用户"')
Else
HotKeySet("{ENTER}")
Send("{enter}")
HotKeySet("{ENTER}", "_ENTER1")
EndIf
EndFunc 呃....释放热键不带函数就行?汗...俺试试看
[ 本帖最后由 palkiller 于 2008-9-24 09:09 编辑 ]
页:
[1]