#include <GUIConstantsEx.au3>
$mainwindow = GUICreate("Hello World", 300, 200)
GUICtrlCreateLabel("Hello world!", 30, 10)
$okbutton = GUICtrlCreateButton("opened the subform", 20, 30, 150)
主窗口点击按钮后又创建了一个新的子窗口,在关闭子窗口时主窗口也关闭了
$dummywindow = GUICreate("Dummy window for testing ", 200, 100)
GUISwitch($mainwindow)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg(1)
Select
Case $msg[0] = $okbutton
GUISetState(@SW_SHOW,$dummywindow)
Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $mainwindow
Exit
Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $dummywindow
GUISetState(@SW_HIDE,$dummywindow)
EndSelect
WEnd