Jump to content

Changing zorder of GUICtrlCreateGraphic possible?


Recommended Posts

10 hours ago, JockoDundee said:

Minimal code snippet required.  

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>



$hParentWindow = GUICreate("Main", 500, 500)
GUISetState()


GUISwitch($hParentWindow) ;Created bevor Child GUI
GUICtrlCreateGraphic(110, 100, 100, 100)
GUICtrlSetBkColor(-1, 0xFF0000)


$hChildWIndow = GUICreate("Child", 150, 150, 150, 150, $WS_CHILD, -1, $hParentWindow)
GUISetBkColor(0x000000)
GUISetState()

GUISwitch($hParentWindow) ;Created after Child GUI
GUICtrlCreateGraphic(230, 100, 100, 100, $WS_EX_TOPMOST)
GUICtrlSetBkColor(-1, 0xFF0000)






While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

as you can see here , i need to find a way to get the Graphic on top of the Child GUI, but it needs to work after the Child GUI is created

Link to post
Share on other sites

Maybe this way ?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPISysWin.au3>

$hParentWindow = GUICreate("Main", 500, 500)
GUISetState()

GUISwitch($hParentWindow) ;Created bevor Child GUI
GUICtrlCreateGraphic(110, 100, 100, 100)
GUICtrlSetBkColor(-1, 0xFF0000) ; red

$hChildWIndow = GUICreate("Child", 150, 150, 150, 150, $WS_CHILD, -1, $hParentWindow)
GUISetBkColor(0x000000)
GUISetState()

GUISwitch($hParentWindow) ;Created after Child GUI
GUICtrlCreateGraphic(230, 100, 100, 100)
GUICtrlSetBkColor(-1, 0x00FF00) ; green

_WinAPI_SetWindowPos($hChildWIndow, $HWND_BOTTOM , 0, 0, 0, 0, BitOR($SWP_NOMOVE, $SWP_NOSIZE))

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

 

Link to post
Share on other sites
42 minutes ago, pixelsearch said:

Maybe this way ?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPISysWin.au3>

$hParentWindow = GUICreate("Main", 500, 500)
GUISetState()

GUISwitch($hParentWindow) ;Created bevor Child GUI
GUICtrlCreateGraphic(110, 100, 100, 100)
GUICtrlSetBkColor(-1, 0xFF0000) ; red

$hChildWIndow = GUICreate("Child", 150, 150, 150, 150, $WS_CHILD, -1, $hParentWindow)
GUISetBkColor(0x000000)
GUISetState()

GUISwitch($hParentWindow) ;Created after Child GUI
GUICtrlCreateGraphic(230, 100, 100, 100)
GUICtrlSetBkColor(-1, 0x00FF00) ; green

_WinAPI_SetWindowPos($hChildWIndow, $HWND_BOTTOM , 0, 0, 0, 0, BitOR($SWP_NOMOVE, $SWP_NOSIZE))

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

 

thank you 🙂

Link to post
Share on other sites

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...