vanowm Posted June 7, 2008 Share Posted June 7, 2008 (edited) Hello! I set so double click on tray icon would open a GUI window. Then, if the GUI window looses focus double click on tray icon doesn't bring the GUI window upfront. Is this behavior normal and expected? If its normal, then is there other, more "practical" function to focus a GUI window other then WinActivate() ? Thank you. P.S. here is an example:expandcollapse popup#NoTrayIcon #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) Opt("GUICloseOnESC", 1) Opt("TrayMenuMode",1) Opt("TrayOnEventMode",1) Opt("TrayAutoPause",0) Opt("TrayIconDebug",1) $TrayGUI = TrayCreateItem("&Open GUI") TrayItemSetOnEvent($TrayGUI, "GUI") TrayItemSetState($TrayGUI, 512) TrayItemSetOnEvent(TrayCreateItem("&Exit"), "_Exit") TraySetClick(16) TraySetState() Global $GUI, $GUICreated = 0 Func GUI() If NOT $GUICreated Then $GUI = GuiCreate("Test") $GUICReated = 1 EndIf GUISetState(@SW_SHOW, $GUI) GUISetOnEvent($GUI_EVENT_CLOSE, "GUIClose", $GUI) EndFunc Func GUIClose() GUISetState(@SW_HIDE, $GUI) EndFunc Func _Exit() Exit EndFunc While 1 Sleep(100) WEnd Edited June 7, 2008 by vanowm Link to comment Share on other sites More sharing options...
rasim Posted June 7, 2008 Share Posted June 7, 2008 Hi! Try this: #NoTrayIcon #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) Opt("GUICloseOnESC", 1) Opt("TrayMenuMode",1) Opt("TrayOnEventMode",1) Opt("TrayAutoPause",0) Opt("TrayIconDebug",1) $GUI = GuiCreate("Test") GUISetOnEvent($GUI_EVENT_CLOSE, "GUIClose", $GUI) $TrayGUI = TrayCreateItem("&Open GUI") TrayItemSetOnEvent($TrayGUI, "_GUI_SHOW") TrayItemSetState($TrayGUI, 512) TrayItemSetOnEvent(TrayCreateItem("&Exit"), "_Exit") TraySetClick(16) TraySetState() While 1 Sleep(100) WEnd Func _GUI_SHOW() If Not BitAND(WinGetState($GUI), 2) Then GUISetState(@SW_SHOW, $GUI) If Not BitAND(WinGetState($GUI), 8) Then GUISetState(@SW_RESTORE) EndFunc Func GUIClose() GUISetState(@SW_HIDE, $GUI) EndFunc Func _Exit() Exit EndFunc Link to comment Share on other sites More sharing options...
vanowm Posted June 7, 2008 Author Share Posted June 7, 2008 Excellent! Works like a charm. Thank you very much Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now