Jump to content

Recommended Posts

Posted (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 by SEKOMD
  • Solution
Posted (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

#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 )

#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 by ioa747

I know that I know nothing

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...