Opt("GUIOnEventMode", 1)
$Main_GUI = GUICreate("父窗口", 280, 280)
GUISetOnEvent(-3, "_GuiMsg")
$Btn_Show = GUICtrlCreateButton("子窗口", 92, 110, 100, 30)
GUISetState(@SW_SHOW, $Main_GUI)
$Child1_GUI = GUICreate("子窗口", 200, 100)
GUISetOnEvent(-3, "_GuiMsg")
$Btn_Test1 = GUICtrlCreateButton("显示", 50, 20, 100, 30)
GUICtrlSetOnEvent($Btn_Show, "_GuiMsg")
GUICtrlSetOnEvent($Btn_Test1, "_GuiMsg")
While 1
Sleep(250)
WEnd
Func _GuiMsg()
Switch @GUI_CtrlId
Case - 3
Switch @GUI_WinHandle
Case $Main_GUI
Exit
Case $Child1_GUI
GUISetState(@SW_ENABLE, $Main_GUI)
GUISetState(@SW_HIDE, $Child1_GUI)
EndSwitch
Case $Btn_Show
GUISetState(@SW_SHOW, $Child1_GUI)
GUISetState(@SW_DISABLE, $Main_GUI)
Case $Btn_Test1
MsgBox(64, "测试", "我是子窗口")
EndSwitch
EndFunc ;==>_GuiMsg
|