Sign in to follow this  
Followers 0
Hylia

Close one GUI and open a new GUI

2 posts in this topic

#1 ·  Posted (edited)

Hi, I'm playing around with Servers and Clients in AutoIT, and I wanted to have an inital GUI (see code 1) where I can specify my port and IP then click a button to start the server, when I click the button I want the current GUI to close and a new GUI to open, how would I go about doing such a thing?

 

So basically, the question boils down to: How do I remove a window created by GUICreate?

 

 

func ServerLauncher()
   ; Server Init
   $MainForm = GUICreate("Server Starter", 158, 113, 192, 124)
   $IP = _GUICtrlIpAddress_Create($MainForm, 16, 16, 130, 21)
   _GUICtrlIpAddress_Set($IP, "127.0.0.1")
   $Port = GUICtrlCreateInput("Port", 56, 44, 49, 21)
   $bStartServer = GUICtrlCreateButton("Start Server", 40, 72, 75, 25)
   GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
Case $GUI_EVENT_CLOSE
            Exit
         Case $bStartServer
            ExitLoop
    EndSwitch
 WEnd
EndFunc
Edited by Hylia

Share this post


Link to post
Share on other sites



Ok I solved it, instead of calling GUIDelete($MainFom) in my second GUI code, I had to call it at:

 Case $bStartServer
            GUIDelete($MainForm)
            ExitLoop

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0