本帖最后由 lynfr8 于 2009-6-9 22:23 编辑
不隐藏主窗口的情况下弹出一个子窗口,并且在不关闭子窗口时无法访问主窗口
代码修改于作者sanhen#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#include <winapi.au3>
Opt("GUIOnEventMode", 1)
$Main_GUI = GUICreate("Main", 500, 500)
GUISetOnEvent($GUI_EVENT_CLOSE, "_GuiMsg")
GUISetBkColor(0x008040, $Main_GUI)
$Btn_Show = GUICtrlCreateButton("Show All", 10, 10, 90, 20)
GUISetState(@SW_SHOW, $Main_GUI)
$Child1_GUI = GUICreate("Child1", 200, 100, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
GUISetOnEvent($GUI_EVENT_CLOSE, "_GuiMsg")
$Btn_Test1 = GUICtrlCreateButton("Test", 10, 10, 90, 20)
GUICtrlSetOnEvent($Btn_Show, "_GuiMsg")
GUICtrlSetOnEvent($Btn_Test1, "_GuiMsg")
While 1
Sleep(250)
WEnd
Func _GuiMsg()
Switch @GUI_CTRLID
Case $GUI_EVENT_CLOSE
Switch @GUI_WinHandle
Case $Main_GUI
Exit
Case $Child1_GUI
GUISetState(@SW_HIDE,$Child1_GUI )
GUISetState(@SW_ENABLE ,$Main_GUI )
EndSwitch
Case $Btn_Show
GUISetState(@SW_SHOW,$Child1_GUI )
GUISetState(@SW_DISABLE ,$Main_GUI )
Case $Btn_Test1
MsgBox(64,"测试","我是子窗口")
EndSwitch
EndFunc
|