本帖最后由 kk_lee69 于 2015-3-18 00:21 编辑
在父子窗口下,有 ABC 三个子窗,请问如何知道 哪个子窗 目前为最上层呢??
#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#include <winapi.au3>
Opt("GUIOnEventMode", 1)
;Global Const $SC_CLOSE = 0xF060
Local $ChildForm[1] = [0], $ChildBtn[1] = [0]
$WinMain = GUICreate("Main", 1000,750,-1,-1, $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX + $WS_SIZEBOX)
GUISetOnEvent($GUI_EVENT_CLOSE,"GUI_COMMAND")
GUISetState(@SW_SHOW, $WinMain)
$WinMainSub=GUICreate("A視窗", 300,300, 200, 200, BitOR($WS_CHILD, $WS_CAPTION),-1, $WinMain)
_WinAPI_SetParent($WinMainSub, $WinMain)
GUISetState(@SW_SHOW, $WinMainSub)
$WinMainSub2=GUICreate("B視窗", 300,300,300, 300,BitOR($WS_CHILD, $WS_CAPTION),-1, $WinMain)
_WinAPI_SetParent($WinMainSub2,$WinMain)
GUISetState(@SW_SHOW, $WinMainSub2)
$WinMainSub3=GUICreate("C視窗", 300,300,400, 400,BitOR($WS_CHILD, $WS_CAPTION),-1, $WinMain)
_WinAPI_SetParent($WinMainSub2,$WinMain)
GUISetState(@SW_SHOW, $WinMainSub3)
GUISetOnEvent($GUI_EVENT_CLOSE,"GUI_COMMAND")
While 1
Sleep(20)
WEnd
Func GUI_COMMAND()
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE
Switch @GUI_WINHANDLE
Case $WinMain
Exit
Case Else
GUIDelete(@GUI_WINHANDLE)
EndSwitch
EndSwitch
EndFunc
|