seres Posted May 4, 2017 Posted May 4, 2017 Im trying to delete a gui with a command, my problem is that the delete doesnt recognize the gui created If $vFlagBlack = True Then $gui = GuiCreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP); GuiSetState(@SW_SHOW); WinSetOnTop($gui, "", 1); GuiSetBkColor("0x000000"); $vFlagBlack = False Else GUIDelete($gui) $vFlagBlack = True EndIf
InunoTaishou Posted May 4, 2017 Posted May 4, 2017 (edited) #include <GUIConstants.au3> Global $hMain = GUICreate("Main", 120, 45) Global $btnExample = GUICtrlCreateButton("Create GUI", 10, 10, 100, 25) Global $hExample = Null GUISetState(@SW_SHOW, $hMain) While (True) Switch (GUIGetMsg()) Case $GUI_EVENT_CLOSE Exit 0 Case $btnExample ; The $hExample GUI Exists If ($hExample) Then GUIDelete($hExample) $hExample = Null ; The $hExample GUI does not exist Else $hExample = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP) GUISetState(@SW_SHOW, $hExample) EndIf EndSwitch WEnd Try this. Edited May 4, 2017 by InunoTaishou
Jarzyn Posted May 4, 2017 Posted May 4, 2017 You need to declare $gui before if works for me Global $vFlagBlack = True, $gui Func a() If $vFlagBlack = True Then $gui = GuiCreate("", @DesktopWidth, @DesktopHeight, 0, 0); GuiSetState(@SW_SHOW); WinSetOnTop($gui, "", 1); GuiSetBkColor("0x000000"); $vFlagBlack = False Else GUIDelete($gui) $vFlagBlack = True EndIf EndFunc a() Sleep(2000) a() Sorry for my english
seres Posted May 4, 2017 Author Posted May 4, 2017 31 minutes ago, InunoTaishou said: #include <GUIConstants.au3> Global $hMain = GUICreate("Main", 120, 45) Global $btnExample = GUICtrlCreateButton("Create GUI", 10, 10, 100, 25) Global $hExample = Null GUISetState(@SW_SHOW, $hMain) While (True) Switch (GUIGetMsg()) Case $GUI_EVENT_CLOSE Exit 0 Case $btnExample ; The $hExample GUI Exists If ($hExample) Then GUIDelete($hExample) $hExample = Null ; The $hExample GUI does not exist Else $hExample = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP) GUISetState(@SW_SHOW, $hExample) EndIf EndSwitch WEnd Try this. thanks it worked
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