#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("主窗口", 399, 257, 192, 124)
$Button1 = GUICtrlCreateButton("显示子窗口", 24, 144, 121, 33, 0)
$Form2 = GUICreate("子窗口", 200, 100, 150, 100)
$Button2 = GUICtrlCreateButton("显示主窗口", 24, 10, 121, 33, 0)
GUISetState(@SW_SHOW, $Form1)
While 1
$nMsg = GUIGetMsg(1)
Switch $nMsg[0]
Case $GUI_EVENT_CLOSE
If $nMsg[1] == $Form1 Then
Exit
ElseIf $nMsg[1] == $Form2 Then
GUISetState(@SW_SHOW, $Form1)
GUISetState(@SW_HIDE, $Form2)
EndIf
Case $Button1
GUISetState(@SW_SHOW, $Form2)
GUISetState(@SW_HIDE, $Form1)
Case $Button2
GUISetState(@SW_SHOW, $Form1)
GUISetState(@SW_HIDE, $Form2)
EndSwitch
WEnd
|