Jump to content

Recommended Posts

Posted

#include <GUIConstantsEx.au3>
 
 Global $hGUI2 = 9999, $hButton3 = 9999 ; Predeclare the variables with dummy values to prevent firing the Case statements
 
 gui1()
 
 Func gui1()
     $hGUI1 = GUICreate("Gui 1", 200, 200, 100, 100)
     $hButton1 = GUICtrlCreateButton("Msgbox 1", 10, 10, 80, 30)
     $hButton2 = GUICtrlCreateButton("Show Gui 2", 10, 60, 80, 30)
     GUISetState()
 
     While 1
         $aMsg = GUIGetMsg(1) ; Use advanced parameter to get array
         Switch $aMsg[1] ; check which GUI sent the message
             Case $hGUI1
                 Switch $aMsg[0] ; Now check for the messages for $hGUI1
                     Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we exit <<<<<<<<<<<<<<<
                         ExitLoop
                     Case $hButton1
                         MsgBox("", "MsgBox 1", "Test from Gui 1")
                     Case $hButton2
                         GUICtrlSetState($hButton2, $GUI_DISABLE)
                         gui2()
                 EndSwitch
             Case $hGUI2
                 Switch $aMsg[0] ; Now check for the messages for $hGUI2
                     Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we just delete the GUI <<<<<<<<<<<<<<<
                         GUIDelete($hGUI2)
                         GUICtrlSetState($hButton2, $GUI_ENABLE)
                     Case $hButton3
                         MsgBox("", "MsgBox", "Test from Gui 2")
                 EndSwitch
         EndSwitch
     WEnd
 EndFunc   ;==>gui1
 
 Func gui2()
     $hGUI2 = GUICreate("Gui 2", 200, 200, 350, 350)
     $hButton3 = GUICtrlCreateButton("MsgBox 2", 10, 10, 80, 30)
     GUISetState()
 EndFunc   ;==>gui2

Above is my exampe code, Main GUI has 1 button, click this button is clicked, open SUB GUI (new open -> SUB GUI on TOP desktop). Now, I'm choice (Firefox, Skype v.v...) --> SUB GUI not on TOP desktop, I want to delete SUB GUI.

Please help me, thank you so much.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...