NassauSky Posted October 27, 2023 Share Posted October 27, 2023 (edited) Could this be any simpler? What's the proper way of checking the open/closed state of a window since this doesn't work. #include <MsgBoxConstants.au3> ; For $MB_TOPMOST $hGUI = GUICreate("My Simple GUI", 300, 200) GUISetState(@SW_SHOW) MsgBox($MB_TOPMOST, "IsGUIOpen", IsGUIOpen()) WinClose($hGUI) MsgBox($MB_TOPMOST, "IsGUIOpen", IsGUIOpen()) Func IsGUIOpen() If WinExists($hGUI) Then Return 1 ; GUI is open Else Return 0 ; GUI is closed EndIf EndFunc Edited October 27, 2023 by NassauSky Link to comment Share on other sites More sharing options...
Solution Andreik Posted October 27, 2023 Solution Share Posted October 27, 2023 (edited) #include <MsgBoxConstants.au3> ; For $MB_TOPMOST $hGUI = GUICreate("My Simple GUI", 300, 200) GUISetState(@SW_SHOW) MsgBox($MB_TOPMOST, "IsGUIOpen", IsGUIOpen()) GUIDelete($hGUI) MsgBox($MB_TOPMOST, "IsGUIOpen", IsGUIOpen()) Func IsGUIOpen() Return WinExists("My Simple GUI") EndFunc Don't mix GUI functions with Win functions. Basically if you deal with a window created by GUICreate() then you destroy it with GUIDelete(). If you deal with windows that are not created by your script you can use Win functions. PS: IsGUIOpen() can be even simpler, as you can see above Edited October 27, 2023 by Andreik NassauSky 1 Link to comment Share on other sites More sharing options...
NassauSky Posted October 27, 2023 Author Share Posted October 27, 2023 (edited) @Andreik ok it's GUIdelete Edited October 27, 2023 by NassauSky Link to comment Share on other sites More sharing options...
Andreik Posted October 27, 2023 Share Posted October 27, 2023 For the record, it's a similar situation like here. 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