So i'm trying to get a gui window to hide itself when a certain window is not active, but show when that window is active. The problem seems to be that when i show the GUI window, it sets it as the active window, causing my code to back and forth. Any help appreciated. Thank you. (using calculator to test with)
[ autoit ]
#include <GUIConstants.au3> #include <WindowsConstants.au3> $gui = GUICreate("My GUI", 150, 200, @DesktopWidth / 100 * 15, @DesktopHeight / 100 * 90, BitOR($WS_BORDER, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) Opt("GUICoordMode", 2) $Button_2 = GUICtrlCreateButton("Button Test", 0, -1) While 1 $msg = GUIGetMsg() WinSetOnTop($gui, "", 1) $title = WinGetTitle("") ToolTip($title) If $title == "Calculator" Then GUISetState(@SW_SHOW) Else GUISetState(@SW_HIDE) EndIf If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd