#include <GuiConstants.au3> $Main_GUI = GuiCreate("Wizard Demo!", 400, 300) _GuiCtrlCreateSeperator(0, 2, 265, 3, 396) $Back_Button = GUICtrlCreateButton("<<Back", 170, 270, 60) GUICtrlSetState(-1, $GUI_DISABLE) $Next_Button = GUICtrlCreateButton("Next>>", 240, 270, 60) $Exit_Button = GUICtrlCreateButton("Exit", 325, 270, 60) $ChildGui_1 = GuiCreate("Child window 1", 400, 260, 5, 5, $WS_POPUP) $LabelGui1 = GUICtrlCreateLabel("Test 1", 20, 60) $ChildGui_2 = GuiCreate("Child window 2", 400, 260, 5, 5, $WS_POPUP) $LabelGui2 = GUICtrlCreateInput("Some text", 20, 60) $ChildGui_3 = GuiCreate("Child window 3", 400, 260, 5, 5, $WS_POPUP) $LabelGui3 = GUICtrlCreateEdit("More text", 20, 20, 140, 200) DllCall("user32.dll", "int", "SetParent", "hwnd", $ChildGui_1, "hwnd", $Main_GUI) DllCall("user32.dll", "int", "SetParent", "hwnd", $ChildGui_2, "hwnd", $Main_GUI) DllCall("user32.dll", "int", "SetParent", "hwnd", $ChildGui_3, "hwnd", $Main_GUI) GUISetState(@SW_SHOW, $Main_GUI) GUISetState(@SW_SHOW, $ChildGui_1) While 1 $Msg = GUIGetMsg(1) Switch $Msg[0] Case $GUI_EVENT_CLOSE, $Exit_Button If $Msg[0] = $Exit_Button And Not _WinIsVisuible($ChildGui_1) Then $Ask = _MsgBox(256+52, "Attention", "Are you sure you want to exit the Wizard now?", $Msg[1]) If $Ask <> 6 Then ContinueLoop EndIf If $Msg[1] = $Main_GUI Then Exit Case $Next_Button GUICtrlSetState($Back_Button, $GUI_ENABLE) Local $CurrentHandle = 0 Local $NextHandle = 0 Select Case _WinIsVisuible($ChildGui_1) $CurrentHandle = $ChildGui_1 $NextHandle = $ChildGui_2 Case _WinIsVisuible($ChildGui_2) $CurrentHandle = $ChildGui_2 $NextHandle = $ChildGui_3 GUICtrlSetState($Next_Button, $GUI_DISABLE) EndSelect If $CurrentHandle <> 0 Then GUISetState(@SW_HIDE, $CurrentHandle) GUISetState(@SW_SHOW, $NextHandle) EndIf Case $Back_Button GUICtrlSetState($Next_Button, $GUI_ENABLE) Local $CurrentHandle = 0 Local $BackHandle = 0 Select Case _WinIsVisuible($ChildGui_3) $CurrentHandle = $ChildGui_3 $BackHandle = $ChildGui_2 Case _WinIsVisuible($ChildGui_2) $CurrentHandle = $ChildGui_2 $BackHandle = $ChildGui_1 GUICtrlSetState($Back_Button, $GUI_DISABLE) EndSelect If $CurrentHandle <> 0 Then GUISetState(@SW_HIDE, $CurrentHandle) GUISetState(@SW_SHOW, $BackHandle) EndIf EndSwitch WEnd Func _GuiCtrlCreateSeperator($Direction, $Left, $Top, $Width=3, $Lenght=25) Switch $Direction Case 0 GUICtrlCreateLabel("", $Left, $Top, $Lenght, $Width, $SS_SUNKEN) Case 1 GUICtrlCreateLabel("", $Left, $Top, $Width, $Lenght, $SS_SUNKEN) EndSwitch EndFunc Func _MsgBox($MsgBoxType, $MsgBoxTitle, $MsgBoxText, $MainGUI=0) Local $iRet = DllCall ("user32.dll", "int", "MessageBox", _ "hwnd", $MainGUI, _ "str", $MsgBoxText , _ "str", $MsgBoxTitle, _ "int", $MsgBoxType) Return $iRet[0] EndFunc Func _WinIsVisuible($hWnd) Return BitAND(WinGetState($hWnd), 2) EndFunc |