SEKOMD Posted January 15 Posted January 15 (edited) Hello everyone! Please tell me how to make the child window $hGUI_Parent1 always be on top of other child windows? Sorry for my english( #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ColorConstants.au3> #include <Constants.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> #include <MsgBoxConstants.au3> $hGUI = GUICreate('MAIN WINDOW', 600, 600, 200, 200, $WS_POPUP+$WS_SIZEBOX) ;$WS_SIZEBOX - don't work $hGUI_Parent1 = GUICreate('PARENT 1', 200, 200, 20, 20, $WS_POPUP) $hGUI_Parent2 = GUICreate('PARENT 2', 200, 200, 80, 80, $WS_POPUP) GUISetBkColor($COLOR_GREEN, $hGUI) GUISetBkColor($COLOR_RED, $hGUI_Parent1) GUISetBkColor($COLOR_GRAY, $hGUI_Parent2) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hGUI_Parent1) GUISetState(@SW_SHOW, $hGUI_Parent2) _WinAPI_SetParent($hGUI_Parent1,$hGUI) _WinAPI_SetParent($hGUI_Parent2,$hGUI) WinSetOnTop($hGUI_Parent1,'',1) ; << don't work While Sleep(5) ;WinActivate($hGUI_Parent1) ;questionable decision.. Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Edited January 15 by SEKOMD
Solution ioa747 Posted January 15 Solution Posted January 15 (edited) It's not clear which is the parent, so I assume it's the main window. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ColorConstants.au3> #include <Constants.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> #include <MsgBoxConstants.au3> $hGUI = GUICreate('MAIN WINDOW', 600, 600, 200, 200, BitOR($WS_POPUP, $WS_SIZEBOX)) ;$WS_SIZEBOX - don't work $hGUI_Parent1 = GUICreate('PARENT 1', 200, 200, 20, 20, $WS_POPUP, -1, $hGUI) $hGUI_Parent2 = GUICreate('PARENT 2', 200, 200, 80, 80, $WS_POPUP, -1, $hGUI) GUISetBkColor($COLOR_GREEN, $hGUI) GUISetBkColor($COLOR_RED, $hGUI_Parent1) GUISetBkColor($COLOR_GRAY, $hGUI_Parent2) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hGUI_Parent1) GUISetState(@SW_SHOW, $hGUI_Parent2) ;~ _WinAPI_SetParent($hGUI_Parent1,$hGUI) ;~ _WinAPI_SetParent($hGUI_Parent2,$hGUI) ;~ WinSetOnTop($hGUI_Parent1,'',1) ; << don't work While Sleep(5) ;WinActivate($hGUI_Parent1) ;questionable decision.. Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd or like expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ColorConstants.au3> #include <Constants.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> #include <MsgBoxConstants.au3> $hGUI = GUICreate('MAIN WINDOW', 600, 600, 200, 200, BitOR($WS_POPUP, $WS_SIZEBOX)) ;$WS_SIZEBOX - don't work $hGUI_Parent1 = GUICreate('PARENT 1', 200, 200, 20, 20, $WS_POPUP, -1, $hGUI) $hGUI_Parent2 = GUICreate('PARENT 2', 200, 200, 80, 80, $WS_POPUP, -1, $hGUI) GUISetBkColor($COLOR_GREEN, $hGUI) GUISetBkColor($COLOR_RED, $hGUI_Parent1) GUISetBkColor($COLOR_GRAY, $hGUI_Parent2) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hGUI_Parent2) GUISetState(@SW_SHOW, $hGUI_Parent1) ;~ _WinAPI_SetParent($hGUI_Parent1,$hGUI) ;~ _WinAPI_SetParent($hGUI_Parent2,$hGUI) ;~ WinSetOnTop($hGUI_Parent1,'',1) ; << don't work While Sleep(5) ;WinActivate($hGUI_Parent1) ;questionable decision.. Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd or option 3 ( with emphasis on always ) expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ColorConstants.au3> #include <Constants.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> #include <MsgBoxConstants.au3> $hGUI = GUICreate('MAIN WINDOW', 600, 600, 200, 200, BitOR($WS_POPUP, $WS_SIZEBOX)) ;$WS_SIZEBOX - don't work $hGUI_Parent2 = GUICreate('PARENT 2', 200, 200, 80, 80, $WS_POPUP, -1, $hGUI) $hGUI_Parent1 = GUICreate('PARENT 1', 200, 200, 20, 20, $WS_POPUP, -1, $hGUI_Parent2) GUISetBkColor($COLOR_GREEN, $hGUI) GUISetBkColor($COLOR_GRAY, $hGUI_Parent2) GUISetBkColor($COLOR_RED, $hGUI_Parent1) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hGUI_Parent2) GUISetState(@SW_SHOW, $hGUI_Parent1) ;~ _WinAPI_SetParent($hGUI_Parent1,$hGUI) ;~ _WinAPI_SetParent($hGUI_Parent2,$hGUI) ;~ WinSetOnTop($hGUI_Parent1,'',1) ; << don't work While Sleep(5) ;WinActivate($hGUI_Parent1) ;questionable decision.. Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Edited January 15 by ioa747 SEKOMD 1 I know that I know nothing
SEKOMD Posted January 15 Author Posted January 15 ioa747 Bravo, maestro! Thank you very much!! ioa747 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now