#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 800, 600)
$Button1 = GUICtrlCreateButton("子窗口", 360, 280, 80, 25)
GUISetState(@SW_SHOW,$Form1)
Opt("GUIOnEventMode", 1)
GUICtrlSetOnEvent($Button1, "Form2")
GUISetOnEvent($GUI_EVENT_CLOSE, "quit")
$Form2 = GUICreate("Form2", 640, 480,-1,-1,-1,-1,$Form1)
$Button2 = GUICtrlCreateButton("退出子窗口", 270, 220, 100, 25)
GUICtrlSetOnEvent($Button2, "Form2")
While 1
sleep(10)
WEnd
func quit()
exit
endfunc
func Form2()
if WinGetState($Form2) < 7 then
GUISetState(@SW_DISABLE, $Form1)
GUISetState(@SW_SHOW,$Form2)
else
GUISetState(@SW_HIDE,$Form2)
GUISetState(@SW_ENABLE, $Form1)
endif
endfunc
|