在数个子窗口中如何知道,ABC三个子窗 哪个在最上层???[已解决]
本帖最后由 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 = , $ChildBtn =
$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 GetWindow(hWnd,GW_HWNDPREV)
返回为NULL则为最上层 获取当前的活动窗体不就完了 回复 3# netegg
他要的是子窗口,获取活动窗口的话得到的可能是父窗口 回复 2# ceoguang
老大 再幫幫忙吧!!
我知道您說要用 _WinAPI_GetWindow 這個函數 但是 查了說明上面沒範例
老實說 實在不知道該如何應用!!
可以舉簡單的例子 說明一下嗎?? 回复 5# kk_lee69 Local $aHwnd = [$WinMainSub, $WinMainSub2, $WinMainSub3]
For $i = 0 To 2
If _WinAPI_GetWindow($aHwnd[$i], 3) = 0 Then
MsgBox(0, '', $aHwnd[$i] & ' 为顶层子窗口')
EndIf
Next 回复 6# ceoguang
懂了 了解 ~~會用了 感謝!!^^ #Include <WinAPIEx.au3>
_WinAPI_GetTopWindow 感谢楼主的分享,谢谢 感谢楼主的分享,谢谢。
页:
[1]