#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
$main = GuiCreate("MyGUI", 340, 60,-1, -1,BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GUISetOnEvent($GUI_EVENT_CLOSE, "gui")
$Button_1 = GuiCtrlCreateButton("显示窗口1", 10, 10, 100, 40)
$Button_2 = GuiCtrlCreateButton("显示窗口2", 120, 10, 100, 40)
$Button_3 = GuiCtrlCreateButton("显示窗口3", 230, 10, 100, 40)
GUISetState()
GUISetOnEvent($GUI_EVENT_CLOSE, "gui")
GUICtrlSetOnEvent($Button_2, "gui")
GUICtrlSetOnEvent($Button_3, "gui")
GUICtrlSetOnEvent($Button_1, "gui")
While 1
;;;
WEnd
Exit
Func gui()
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE
Switch @GUI_WINHANDLE
Case $main
Exit
Case Else
GUIDelete(@GUI_WINHANDLE)
EndSwitch
Case $Button_2
if WinExists("子窗口2") = 0 Then
GuiCreate("子窗口2", 140, 60,10,100,-1,-1,$main)
GUISetState()
GUISetOnEvent($GUI_EVENT_CLOSE, "gui")
EndIf
Case $Button_3
if WinExists("子窗口3") = 0 Then
GuiCreate("子窗口3", 140, 60,160,100,-1,-1,$main)
GUISetState()
GUISetOnEvent($GUI_EVENT_CLOSE, "gui")
EndIf
Case $Button_1
add()
EndSwitch
EndFunc
Func add()
$Form1 = GUICreate("Form1", 157, 72, 193, 115)
$Button1 = GUICtrlCreateButton("Button1", 32, 24, 75, 25, 0)
GUISetState()
GUISetOnEvent($GUI_EVENT_CLOSE, "gui")
While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $Button1
MsgBox(0,"","111")
EndSwitch
WEnd
EndFunc ;==>add
GUIOnEventMode多窗口模式不太理解 请大家指点一下
[ 本帖最后由 kryiran 于 2008-8-21 21:32 编辑 ] |