关于快捷键问题!!
在GUI中,用Hotkeyset设定的快捷键.能否让他只在窗口激活的情况下有效,在窗口未激活时无效?[ 本帖最后由 amgloon 于 2008-12-14 15:29 编辑 ] 这个是白文大哥的解决方案
使用HotKey停止 又怕影响其它的软件运行
可以使用判定窗口状态来解决
举例:
The au3 Code:
关于插件打印代码保存代码复制代码普通浏览HotKeySet ( "{Enter}" ,"GuiExit" )
$Form = GuiCreate("",200,200)
GuiSetState()
while 1
sleep(50)
wend
Func GuiExit()
if bitand(WinGetState ( $Form),8 ) then
exit
else
HotKeySet("{Enter}")
Send("{Enter}")
HotKeySet("{Enter}", "GuiExit")
endif
EndFunc
这样也行,借花献佛了。
#include <GuiConstants.au3>HotKeySet("{ENTER}", "catchguikey")
$gui = GuiCreate("Hotkey Test")
GuiCtrlCreateLabel("Press Enter", 0, 0)
GuiSetState()
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
Func catchguikey()
Local $opt = Opt("WinTitleMatchMode", 4)
If WinGetHandle("active") = $gui Then
If @HotKeyPressed = "{ENTER}" Then
;Do something here
ToolTip("Key Pressed")
Sleep(1000)
ToolTip("")
EndIf
Else
HotKeySet(@HotKeyPressed)
Send(@HotKeyPressed)
HotKeySet(@HotKeyPressed, "catchguikey")
EndIf
Opt("WinTitleMatchMode", $opt)
EndFunc ..谢了 :face (37): :face (37):
页:
[1]