#include <GuiConstantsEx.au3>
Opt("GUIOnEventMode", 1); 切换为 OnEvent 模式
Global $mune1, $mune2, $mune3,$mune4,$mune5,$BS_FLAT, $BS_CENTER
$Win=GUICreate("my test ",400,400,700,350)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") ; 设置窗口关闭事件
$mune1 = GUICtrlCreateMenu("文件[&F]")
$next_mune1= GUICtrlCreateMenuItem("退出程序[&X]",$mune1)
GUICtrlSetOnEvent($next_mune1, "CLOSEClicked") ; 设置窗口关闭事件
$Button_tab0=GUICtrlCreateButton("Network Settings",260,290,Default,Default,$BS_FLAT & $BS_CENTER)
$Button_color=GUICtrlSetColor($Button_tab0,0x000080)
GUICtrlSetOnEvent($Button_tab0, "OKButton");当某个控件被点击发送控件事件
GUICtrlSetTip(-1,"进入目标设备配置")
$win_Childw = GUICreate("network settings Top mesh",400,200,700,450)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked2") ; 设置窗口关闭事件
GUISwitch($Win)
GUISetState(@SW_SHOW)
While 1
Sleep(100)
WEnd
Func OKButton()
GUISwitch($win_Childw)
GUISetState(@SW_SHOW)
EndFunc
Func CLOSEClicked()
If MsgBox(1,"警告","你真的要退出吗?")=1 Then Exit
EndFunc
Func CLOSEClicked2()
GUISwitch($win)
GUISetState(@SW_HIDE,$win_Childw)
EndFunc
|