#include <GuiConstants.au3>
Opt("GUIOnEventMode", 1)
$main = GuiCreate("MyGUI", 340, 60,-1, -1 )
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
Opt("GUIOnEventMode", 0)
GuiCreate("子窗口2", 140, 60,10,100,-1,-1,$main)
$jjjj = GUICtrlCreateButton("454454", 5, 5, 100, 50)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit ;全部退出,能力有限,暂时没什么高招解决.当然,如果你能解决的话,希望你可以发上来分享
Case $jjjj
MsgBox(64,"提示","当前按钮被点击!!",10)
EndSwitch
WEnd
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
if WinExists("子窗口1") = 0 Then
GuiCreate("子窗口1", 140, 60,300,100,-1,-1,$main)
GUISetState()
GUISetOnEvent($GUI_EVENT_CLOSE, "gui")
EndIf
EndSwitch
EndFunc ;==>gui
呵呵,还是用LS的吧!
[ 本帖最后由 ceoguang 于 2008-5-14 13:49 编辑 ] |