#cs Filename: Example1 Purpose: To test the calling of two forms [Form1 and Form2], by 1) Exiting Form1 2) Launching Form2 3) Exiting Form2 4) Launching Form1 Observations: Needed to add a ConsoleWrite just after the call to Form2. • Only one form is open at a time. Status: Ok! Date: 12/28/24 #ce ; ----------------------------------------------- #include #include #include #include ; ----------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- _Form1() ; ----------------------------------------------- Func _Form1() ConsoleWrite("Inside _Form1()" & @CRLF) Local $MainGui1 = GUICreate("_Form1", 170, 75) GUISetFont(14, 800, 0, "Calibri") ; ----------------------------------------------- Local $sCol1Row1 = GUICtrlCreateButton("Go to Form2", 10, 10, 150, 25) Local $sCol1Row2 = GUICtrlCreateButton("Exit Me", 10, 40, 150, 25) ; ----------------------------------------------- GUISetState(@SW_SHOW) ; ----------------------------------------------- While 1 Local $nMsg = GUIGetMsg() ; ----------------- Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $sCol1Row1 GUIDelete($MainGui1) _Form2() Case $sCol1Row2 _ExitMe() EndSwitch WEnd EndFunc ;==>_Form1 ; ----------------------------------------------- Func _Form2() ConsoleWrite("Inside _Form2()" & @CRLF) Local $MainGui2 = GUICreate("_Form2", 170, 75) GUISetFont(14, 800, 0, "Calibri") ; ----------------------------------------------- Local $sColRow = GUICtrlCreateButton("Return to Form1", 10, 10, 150, 25) ; ----------------------------------------------- GUISetState(@SW_SHOW) ; ----------------------------------------------- While 1 Local $nMsg = GUIGetMsg() ; ----------------- Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $sColRow GUIDelete($MainGui2) ConsoleWrite("Returning to Form1" & @CRLF) _Form1() EndSwitch WEnd EndFunc ;==>_Form2 ; ----------------------------------------------- Func _ExitMe() ConsoleWrite("Inside _ExitMe()" & @CRLF) Exit EndFunc ;==>_ExitMe ; -----------------------------------------------