#include <GuiConstants.au3>
Global $subGUI, $Button_5, $Button_6
GUICreate("MyGUI", 372, 88, -1, -1)
$Progress_1 = GUICtrlCreateProgress(10, 10, 370, 20)
$Button_2 = GUICtrlCreateButton("start", 10, 40, 60, 30)
$Button_3 = GUICtrlCreateButton("pause", 80, 40, 60, 30)
$Button_4 = GUICtrlCreateButton("exit", 150, 40, 70, 30)
Opt("GUIOnEventMode", 1)
Dim $start = 0, $ostart
GUISetState()
GUISetOnEvent($GUI_EVENT_CLOSE, "gui")
GUICtrlSetOnEvent($Button_2, "gui")
GUICtrlSetOnEvent($Button_3, "gui")
GUICtrlSetOnEvent($Button_4, "gui")
While 1
If $start >= 0 Then
Sleep(50)
$start += 1
If $start > 100 Then $start = 0
If $start >= 0 Then
$ostart = $start
GUICtrlSetData($Progress_1, $start)
Else
ContinueLoop
EndIf
EndIf
WEnd
Exit
Func gui()
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE, $Button_4
Exit
Case $Button_2
subfunc()
Case $Button_3
If $start < 0 Then
$start = $ostart
Else
$start = -100
EndIf
EndSwitch
EndFunc ;==>gui
Func subfunc()
$subGUI = GUICreate("SubGUI", 372, 88, -1, -1)
$Button_5 = GUICtrlCreateButton("start1", 10, 40, 60, 30)
$Button_6 = GUICtrlCreateButton("exit", 150, 40, 70, 30)
GUISetOnEvent($GUI_EVENT_CLOSE, "subgui")
GUICtrlSetOnEvent($Button_5, "subgui")
GUICtrlSetOnEvent($Button_6, "subgui")
GUISetState()
EndFunc
Func subgui()
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE, $Button_6
GUIDelete($subGUI)
Case $Button_5
MsgBox(1,"","Sub OK")
EndSwitch
EndFunc ;==>gui