<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.autoitscript.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Johnmcloud</id>
	<title>AutoIt Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.autoitscript.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Johnmcloud"/>
	<link rel="alternate" type="text/html" href="https://www.autoitscript.com/wiki/Special:Contributions/Johnmcloud"/>
	<updated>2026-04-22T10:41:35Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://www.autoitscript.com/w/index.php?title=Managing_Multiple_GUIs&amp;diff=13048</id>
		<title>Managing Multiple GUIs</title>
		<link rel="alternate" type="text/html" href="https://www.autoitscript.com/w/index.php?title=Managing_Multiple_GUIs&amp;diff=13048"/>
		<updated>2015-05-23T18:04:26Z</updated>

		<summary type="html">&lt;p&gt;Johnmcloud: /* MessageLoop Mode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Having several GUIs on the screen at the same time is fairly common but structuring your code to deal with this can seem quite daunting. However, as I hope this tutorial will demonstrate, it is nowhere near as difficult as it first appears.  &lt;br /&gt;
&lt;br /&gt;
=MessageLoop Mode=&lt;br /&gt;
&lt;br /&gt;
Let us start with &#039;&#039;MessageLoop&#039;&#039; mode as this is where most new coders run into difficulties with multiple GUIs.  This example script illustrates the problem - it exits when the &#039;&#039;&#039;[X]&#039;&#039;&#039; is clicked on either GUI:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt; #include &amp;lt;GUIConstantsEx.au3&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 Global $hButton3 = 9999&lt;br /&gt;
 &lt;br /&gt;
 gui1()&lt;br /&gt;
 &lt;br /&gt;
 Func gui1()&lt;br /&gt;
     $hGUI1 = GUICreate(&amp;quot;Gui 1&amp;quot;, 200, 200, 100, 100)&lt;br /&gt;
     $hButton1 = GUICtrlCreateButton(&amp;quot;Msgbox 1&amp;quot;, 10, 10, 80, 30)&lt;br /&gt;
     $hButton2 = GUICtrlCreateButton(&amp;quot;Show Gui 2&amp;quot;, 10, 60, 80, 30)&lt;br /&gt;
     GUISetState()&lt;br /&gt;
 &lt;br /&gt;
     While 1&lt;br /&gt;
         Switch GUIGetMsg()&lt;br /&gt;
             Case $GUI_EVENT_CLOSE&lt;br /&gt;
                 ExitLoop&lt;br /&gt;
             Case $hButton1&lt;br /&gt;
                 MsgBox(&amp;quot;&amp;quot;, &amp;quot;MsgBox 1&amp;quot;, &amp;quot;Test from Gui 1&amp;quot;)&lt;br /&gt;
             Case $hButton2&lt;br /&gt;
                 GUICtrlSetState($hButton2, $GUI_DISABLE)&lt;br /&gt;
                 gui2()&lt;br /&gt;
             Case $hButton3&lt;br /&gt;
                 MsgBox(&amp;quot;&amp;quot;, &amp;quot;MsgBox 2&amp;quot;, &amp;quot;Test from Gui 2&amp;quot;) &lt;br /&gt;
         EndSwitch&lt;br /&gt;
     WEnd&lt;br /&gt;
 EndFunc   ;==&amp;gt;gui1&lt;br /&gt;
 &lt;br /&gt;
 Func gui2()&lt;br /&gt;
     $hGUI2 = GUICreate(&amp;quot;Gui 2&amp;quot;, 200, 200, 350, 350)&lt;br /&gt;
     $hButton3 = GUICtrlCreateButton(&amp;quot;MsgBox 2&amp;quot;, 10, 10, 80, 30)&lt;br /&gt;
     GUISetState()&lt;br /&gt;
 EndFunc   ;==&amp;gt;gui2 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The script exits because it has a single &#039;&#039;GUIGetMsg&#039;&#039; loop and the &#039;&#039;$GUI_EVENT_CLOSE&#039;&#039; message is received when either &#039;&#039;&#039;[X]&#039;&#039;&#039; is clicked - we have no way of telling the messages from the two GUIs apart.&lt;br /&gt;
&lt;br /&gt;
The simplest solution is to disable the first GUI while the second is displayed:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt; #include &amp;lt;GUIConstantsEx.au3&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 gui1()&lt;br /&gt;
 &lt;br /&gt;
 Func gui1()&lt;br /&gt;
     $hGUI1 = GUICreate(&amp;quot;Gui 1&amp;quot;, 200, 200, 100, 100)&lt;br /&gt;
     $hButton1 = GUICtrlCreateButton(&amp;quot;Msgbox 1&amp;quot;, 10, 10, 80, 30)&lt;br /&gt;
     $hButton2 = GUICtrlCreateButton(&amp;quot;Show Gui 2&amp;quot;, 10, 60, 80, 30)&lt;br /&gt;
     GUISetState()&lt;br /&gt;
 &lt;br /&gt;
     While 1&lt;br /&gt;
         Switch GUIGetMsg()&lt;br /&gt;
             Case $GUI_EVENT_CLOSE&lt;br /&gt;
                 ExitLoop&lt;br /&gt;
             Case $hButton1&lt;br /&gt;
                 MsgBox(&amp;quot;&amp;quot;, &amp;quot;MsgBox 1&amp;quot;, &amp;quot;Test from Gui 1&amp;quot;)&lt;br /&gt;
             Case $hButton2&lt;br /&gt;
                 ; Disable the first GUI&lt;br /&gt;
                 GUISetState(@SW_DISABLE, $hGUI1)&lt;br /&gt;
                 gui2()&lt;br /&gt;
                 ; Re-enable the first GUI&lt;br /&gt;
                 GUISetState(@SW_ENABLE, $hGUI1)&lt;br /&gt;
         EndSwitch&lt;br /&gt;
     WEnd&lt;br /&gt;
 EndFunc   ;==&amp;gt;gui1&lt;br /&gt;
 &lt;br /&gt;
 Func gui2()&lt;br /&gt;
     $hGUI2 = GUICreate(&amp;quot;Gui 2&amp;quot;, 200, 200, 350, 350)&lt;br /&gt;
     $hButton3 = GUICtrlCreateButton(&amp;quot;MsgBox 2&amp;quot;, 10, 10, 80, 30)&lt;br /&gt;
     GUISetState()&lt;br /&gt;
 &lt;br /&gt;
     While 1&lt;br /&gt;
         ; We can only get messages from the second GUI&lt;br /&gt;
         Switch GUIGetMsg()&lt;br /&gt;
             Case $GUI_EVENT_CLOSE&lt;br /&gt;
                 GUIDelete($hGUI2)&lt;br /&gt;
                 ExitLoop&lt;br /&gt;
             Case $hButton3&lt;br /&gt;
                 MsgBox(&amp;quot;&amp;quot;, &amp;quot;MsgBox 2&amp;quot;, &amp;quot;Test from Gui 2&amp;quot;)&lt;br /&gt;
 		EndSwitch&lt;br /&gt;
 	WEnd&lt;br /&gt;
 EndFunc   ;==&amp;gt;gui2 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This may well be all you need, but it does mean that we cannot action any of the controls on the first GUI until we close the second.  And importantly we remain blocked in the &#039;&#039;While...WEnd&#039;&#039; loop within the &#039;&#039;gui2&#039;&#039; function - go and read the [[Interrupting a running function]] tutorial to see why this is less than ideal.&lt;br /&gt;
&lt;br /&gt;
So how can we deal with multiple GUIs visible at the same time?  Fortunately AutoIt offers us a simple way to differentiate between GUIs in &#039;&#039;MessageLoop&#039;&#039; mode.  Normally we use code like this in our idle loop to detect the messages sent by our GUI and its controls:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt; Switch GUIGetMsg()&lt;br /&gt;
     Case $GUI_EVENT_CLOSE&lt;br /&gt;
         ; Code&lt;br /&gt;
     Case $hButton1&lt;br /&gt;
         ; Code&lt;br /&gt;
 EndSwitch &amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
But when dealing with multiple GUIs, we need to use the &amp;quot;&#039;&#039;advanced&#039;&#039;&amp;quot; parameter when we call &#039;&#039;GUIGetMsg&#039;&#039;.  As explained in the Help file, the function then returns an array instead of a single value.  This array includes information on what exactly triggered the message, just what we need to distinguish the message that was sent (element[&#039;&#039;&#039;0&#039;&#039;&#039;] of the array) and which GUI sent it (element[&#039;&#039;&#039;1&#039;&#039;&#039;]).  We can then amend our simple Switch statement above to read like this: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt; $aMsg = GUIGetMsg(1) ; Use advanced parameter to get an array returned&lt;br /&gt;
&lt;br /&gt;
 Switch $aMsg[1] ; First check which GUI sent the message&lt;br /&gt;
     Case $hGUI1&lt;br /&gt;
         Switch $aMsg[0] ; Now check for the messages sent from $hGUI1&lt;br /&gt;
             Case $GUI_EVENT_CLOSE &lt;br /&gt;
                 ; Code&lt;br /&gt;
             Case $hControl&lt;br /&gt;
                 ; Code&lt;br /&gt;
         EndSwitch&lt;br /&gt;
     Case $hGUI2&lt;br /&gt;
         Switch $aMsg[0] ; Now check for the messages sent from $hGUI2&lt;br /&gt;
             Case $GUI_EVENT_CLOSE&lt;br /&gt;
                 ; Code&lt;br /&gt;
             Case $hButton3&lt;br /&gt;
                 ; Code&lt;br /&gt;
         EndSwitch&lt;br /&gt;
 EndSwitch &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Although this looks complicated, if you take a moment to study it and you will quickly realise it is simply two &#039;&#039;Switch&#039;&#039; structures within an outer &#039;&#039;Switch&#039;&#039;.  You have already dealt with a single &#039;&#039;Switch&#039;&#039; structure for a single GUI. All you are doing here is determining which &#039;&#039;Switch&#039;&#039; structure you want to use, and that depends on the GUI which sent the message which is why we need the outer &#039;&#039;Switch&#039;&#039; structure as a wrapper.&lt;br /&gt;
&lt;br /&gt;
So here is an example of how to manage two GUIs simultaneously using the &amp;quot;&#039;&#039;advanced&#039;&#039;&amp;quot; parameter with &#039;&#039;GUIGetMsg&#039;&#039;:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt; #include &amp;lt;GUIConstantsEx.au3&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 Global $hGUI2 = 9999, $hButton3 ; Predeclare the variables with dummy values to prevent firing the Case statements, only for GUI this time&lt;br /&gt;
 &lt;br /&gt;
 gui1()&lt;br /&gt;
 &lt;br /&gt;
 Func gui1()&lt;br /&gt;
     $hGUI1 = GUICreate(&amp;quot;Gui 1&amp;quot;, 200, 200, 100, 100)&lt;br /&gt;
     $hButton1 = GUICtrlCreateButton(&amp;quot;Msgbox 1&amp;quot;, 10, 10, 80, 30)&lt;br /&gt;
     $hButton2 = GUICtrlCreateButton(&amp;quot;Show Gui 2&amp;quot;, 10, 60, 80, 30)&lt;br /&gt;
     GUISetState()&lt;br /&gt;
 &lt;br /&gt;
     While 1&lt;br /&gt;
         $aMsg = GUIGetMsg(1) ; Use advanced parameter to get array&lt;br /&gt;
         Switch $aMsg[1] ; check which GUI sent the message&lt;br /&gt;
             Case $hGUI1&lt;br /&gt;
                 Switch $aMsg[0] ; Now check for the messages for $hGUI1&lt;br /&gt;
                     Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we exit &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;br /&gt;
                         ExitLoop&lt;br /&gt;
                     Case $hButton1&lt;br /&gt;
                         MsgBox(&amp;quot;&amp;quot;, &amp;quot;MsgBox 1&amp;quot;, &amp;quot;Test from Gui 1&amp;quot;)&lt;br /&gt;
                     Case $hButton2&lt;br /&gt;
                         GUICtrlSetState($hButton2, $GUI_DISABLE)&lt;br /&gt;
                         gui2()&lt;br /&gt;
                 EndSwitch&lt;br /&gt;
             Case $hGUI2&lt;br /&gt;
                 Switch $aMsg[0] ; Now check for the messages for $hGUI2&lt;br /&gt;
                     Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we just delete the GUI &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;br /&gt;
                         GUIDelete($hGUI2)&lt;br /&gt;
                         GUICtrlSetState($hButton2, $GUI_ENABLE)&lt;br /&gt;
                     Case $hButton3&lt;br /&gt;
                         MsgBox(&amp;quot;&amp;quot;, &amp;quot;MsgBox&amp;quot;, &amp;quot;Test from Gui 2&amp;quot;)&lt;br /&gt;
                 EndSwitch&lt;br /&gt;
         EndSwitch&lt;br /&gt;
     WEnd&lt;br /&gt;
 EndFunc   ;==&amp;gt;gui1&lt;br /&gt;
 &lt;br /&gt;
 Func gui2()&lt;br /&gt;
     $hGUI2 = GUICreate(&amp;quot;Gui 2&amp;quot;, 200, 200, 350, 350)&lt;br /&gt;
     $hButton3 = GUICtrlCreateButton(&amp;quot;MsgBox 2&amp;quot;, 10, 10, 80, 30)&lt;br /&gt;
     GUISetState()&lt;br /&gt;
 EndFunc   ;==&amp;gt;gui2 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
As you can see, we have a single &#039;&#039;While...WEnd&#039;&#039; loop which distinguishes between the two GUIs, both GUIs and their controls remain active and we stay in the main idle loop while we wait (you did read that other tutorial I hope!).&lt;br /&gt;
&lt;br /&gt;
=OnEvent Mode=&lt;br /&gt;
&lt;br /&gt;
Coders using &#039;&#039;OnEvent&#039;&#039; mode do not usually find the same problem with multiple GUIs as they can code separate functions for each &#039;&#039;$GUI_EVENT_CLOSE&#039;&#039; as shown here:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt; #include &amp;lt;GUIConstantsEx.au3&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 Opt(&amp;quot;GUIOnEventMode&amp;quot;, 1)&lt;br /&gt;
 &lt;br /&gt;
 Global $hGUI2, $hButton2 ; Predeclare these variables&lt;br /&gt;
 &lt;br /&gt;
 gui1()&lt;br /&gt;
 &lt;br /&gt;
 Func gui1()&lt;br /&gt;
     $hGUI1 = GUICreate(&amp;quot;Gui 1&amp;quot;, 200, 200, 100, 100)&lt;br /&gt;
     GUISetOnEvent($GUI_EVENT_CLOSE, &amp;quot;On_Close_Main&amp;quot;) ; Run this function when the main GUI [X] is clicked&lt;br /&gt;
     $hButton1 = GUICtrlCreateButton(&amp;quot;Msgbox 1&amp;quot;, 10, 10, 80, 30)&lt;br /&gt;
     GUICtrlSetOnEvent(-1, &amp;quot;On_Button1&amp;quot;)&lt;br /&gt;
     $hButton2 = GUICtrlCreateButton(&amp;quot;Show Gui 2&amp;quot;, 10, 60, 80, 30)&lt;br /&gt;
     GUICtrlSetOnEvent(-1, &amp;quot;On_Button2&amp;quot;)&lt;br /&gt;
     GUISetState()&lt;br /&gt;
 &lt;br /&gt;
     While 1&lt;br /&gt;
         Sleep(10)&lt;br /&gt;
     WEnd&lt;br /&gt;
 EndFunc   ;==&amp;gt;gui1&lt;br /&gt;
 &lt;br /&gt;
 Func gui2()&lt;br /&gt;
     $hGUI2 = GUICreate(&amp;quot;Gui 2&amp;quot;, 200, 200, 350, 350)&lt;br /&gt;
     GUISetOnEvent($GUI_EVENT_CLOSE, &amp;quot;On_Close_Secondary&amp;quot;) ; Run this function when the secondary GUI [X] is clicked&lt;br /&gt;
     $hButton3 = GUICtrlCreateButton(&amp;quot;MsgBox 2&amp;quot;, 10, 10, 80, 30)&lt;br /&gt;
     GUICtrlSetOnEvent(-1, &amp;quot;On_Button3&amp;quot;)&lt;br /&gt;
     GUISetState()&lt;br /&gt;
 EndFunc   ;==&amp;gt;gui2&lt;br /&gt;
 &lt;br /&gt;
 Func On_Close_Main()&lt;br /&gt;
     Exit&lt;br /&gt;
 EndFunc&lt;br /&gt;
 &lt;br /&gt;
 Func On_Close_Secondary()&lt;br /&gt;
     GUIDelete($hGUI2)&lt;br /&gt;
     GUICtrlSetState($hButton2, $GUI_ENABLE)&lt;br /&gt;
 EndFunc&lt;br /&gt;
 &lt;br /&gt;
 Func On_Button1()&lt;br /&gt;
     MsgBox(&amp;quot;&amp;quot;, &amp;quot;MsgBox 1&amp;quot;, &amp;quot;Test from Gui 1&amp;quot;)&lt;br /&gt;
 EndFunc&lt;br /&gt;
 &lt;br /&gt;
 Func On_Button2()&lt;br /&gt;
     GUICtrlSetState($hButton2, $GUI_DISABLE)&lt;br /&gt;
     gui2()&lt;br /&gt;
 EndFunc&lt;br /&gt;
 &lt;br /&gt;
 Func On_Button3()&lt;br /&gt;
     MsgBox(&amp;quot;&amp;quot;, &amp;quot;MsgBox 2&amp;quot;, &amp;quot;Test from Gui 2&amp;quot;)&lt;br /&gt;
 EndFunc &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
But did you realise that you can also use what some people think of as a hybrid mode - using common &#039;&#039;OnEvent&#039;&#039; functions and then determining the specific GUI or control which called the function within the function?  As an added bonus, this approach may, depending on the circumstances, let you send parameters to the functions you call - something that you normally cannot do in &#039;&#039;OnEvent&#039;&#039; mode.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt; #include &amp;lt;GUIConstantsEx.au3&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 Opt(&amp;quot;GUIOnEventMode&amp;quot;, 1)&lt;br /&gt;
 &lt;br /&gt;
 Global $hGUI1, $hGUI2 = 9999, $hButton1, $hButton2, $hButton3 = 9999 ; Predeclare the variables with dummy values to prevent firing the Case statements&lt;br /&gt;
 &lt;br /&gt;
 gui1()&lt;br /&gt;
 &lt;br /&gt;
 Func gui1()&lt;br /&gt;
     $hGUI1 = GUICreate(&amp;quot;Gui 1&amp;quot;, 200, 200, 100, 100)&lt;br /&gt;
     GUISetOnEvent($GUI_EVENT_CLOSE, &amp;quot;On_Close&amp;quot;) ; Call a common GUI close function&lt;br /&gt;
     $hButton1 = GUICtrlCreateButton(&amp;quot;Msgbox 1&amp;quot;, 10, 10, 80, 30)&lt;br /&gt;
     GUICtrlSetOnEvent(-1, &amp;quot;On_Button&amp;quot;) ; Call a common button function&lt;br /&gt;
     $hButton2 = GUICtrlCreateButton(&amp;quot;Show Gui 2&amp;quot;, 10, 60, 80, 30)&lt;br /&gt;
     GUICtrlSetOnEvent(-1, &amp;quot;On_Button&amp;quot;) ; Call a common button function&lt;br /&gt;
     GUISetState()&lt;br /&gt;
 &lt;br /&gt;
     While 1&lt;br /&gt;
         Sleep(10)&lt;br /&gt;
     WEnd&lt;br /&gt;
 EndFunc   ;==&amp;gt;gui1&lt;br /&gt;
 &lt;br /&gt;
 Func gui2()&lt;br /&gt;
     $hGUI2 = GUICreate(&amp;quot;Gui 2&amp;quot;, 200, 200, 350, 350)&lt;br /&gt;
     GUISetOnEvent($GUI_EVENT_CLOSE, &amp;quot;On_Close&amp;quot;) ; Call a common GUI close function&lt;br /&gt;
     $hButton3 = GUICtrlCreateButton(&amp;quot;MsgBox 2&amp;quot;, 10, 10, 80, 30)&lt;br /&gt;
     GUICtrlSetOnEvent(-1, &amp;quot;On_Button&amp;quot;) ; Call a common button function&lt;br /&gt;
     GUISetState()&lt;br /&gt;
 EndFunc   ;==&amp;gt;gui2&lt;br /&gt;
 &lt;br /&gt;
 Func On_Close()&lt;br /&gt;
     Switch @GUI_WINHANDLE ; See which GUI sent the CLOSE message&lt;br /&gt;
         Case $hGUI1&lt;br /&gt;
             Exit ; If it was this GUI - we exit &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;br /&gt;
         Case $hGUI2&lt;br /&gt;
             GUIDelete($hGUI2) ; If it was this GUI - we just delete the GUI &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;br /&gt;
             GUICtrlSetState($hButton2, $GUI_ENABLE)&lt;br /&gt;
     EndSwitch&lt;br /&gt;
 EndFunc&lt;br /&gt;
 &lt;br /&gt;
 Func On_Button()&lt;br /&gt;
     Switch @GUI_CTRLID ; See which button sent the message&lt;br /&gt;
         Case $hButton1&lt;br /&gt;
             MessageBox(1) ; We can call a function with parameters here &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;br /&gt;
         Case $hButton2&lt;br /&gt;
             GUICtrlSetState($hButton2, $GUI_DISABLE)&lt;br /&gt;
             gui2()&lt;br /&gt;
         Case $hButton3&lt;br /&gt;
             MessageBox(2) ; We can call a function with parameters here &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;br /&gt;
     EndSwitch&lt;br /&gt;
 EndFunc&lt;br /&gt;
 &lt;br /&gt;
 Func MessageBox($iIndex)&lt;br /&gt;
     MsgBox(&amp;quot;&amp;quot;, &amp;quot;MsgBox &amp;quot; &amp;amp; $iIndex, &amp;quot;Test from Gui &amp;quot; &amp;amp; $iIndex)&lt;br /&gt;
 EndFunc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
So you see that managing multiple GUIS is not as difficult as you might think.  One of these methods is bound to suit your script, but do not try and mix them - only one method per script please!&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:GUI]]&lt;/div&gt;</summary>
		<author><name>Johnmcloud</name></author>
	</entry>
</feed>