关闭窗体2不影响窗体1的运行(已解决)
本帖最后由 shenrenba 于 2010-8-23 12:41 编辑比如下面这段代码效果 关闭2后 直接结束运行 如何关闭窗体2 返回1 而且不影响1的关闭#include <GUIConstantsEx.au3>
$form1=GUICreate("测试1",200,150,-1,-1)
$button1=GUICtrlCreateButton("窗体2",75,100,50,25)
$form2=GUICreate("测试2",200,150,-1,-1)
$button2=GUICtrlCreateButton("待定",75,100,50,25)
GUISwitch($form1)
GUISetState()
While 1
$nMsg=GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $button1
GUISetState(@SW_SHOW,$form2)
GUISetState(@SW_HIDE,$form1)
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUISetState(@SW_HIDE,$form2)
GUISetState(@SW_SHOW,$form1)
Case $button2
EndSwitch
EndSwitch
WEnd
#include <GUIConstantsEx.au3>
$form1=GUICreate("测试1",200,150,-1,-1)
$button1=GUICtrlCreateButton("窗体2",75,100,50,25)
GUISetState(@SW_SHOW)
While 1
$nMsg=GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $button1
form2()
EndSwitch
WEnd
func form2()
$form2=GUICreate("测试2",200,150,-1,-1)
$button2=GUICtrlCreateButton("待定",75,100,50,25)
GUISetState(@SW_SHOW,$form2)
GUISetState(@SW_HIDE,$form1)
While 1
$nMsg=GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
exitloop
Case $button2
EndSwitch
WEnd
GUIDelete($form2)
GUISetState(@SW_SHOW,$form1)
endfunc
本帖最后由 lixiaolong 于 2010-8-23 12:27 编辑
回复 1# shenrenba #include <GUIConstantsEx.au3>
$form1=GUICreate("测试1",200,150,-1,-1
$button1=GUICtrlCreateButton("窗体2",75,100,50,25)
$form2=GUICreate("测试2",200,150,-1,-1)
$button2=GUICtrlCreateButton("待定",75,100,50,25)
GUISwitch($form1)
GUISetState()
While 1
$nMsg=GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
If WinActive("测试1")Then
Exit
ElseIf WinActive("测试2")Then
GUISetState(@SW_HIDE,$form2)
GUISetState(@SW_SHOW,$form1)
ContinueLoop
EndIf
Case $button1
GUISetState(@SW_SHOW,$form2)
GUISetState(@SW_HIDE,$form1)
EndSwitch
WEnd
页:
[1]