Jump to content
Sign in to follow this  
kwlayman

Moving Child Windows

Recommended Posts

kwlayman

I'm building a HUD for an application. The HUD consists of up to 10 transparent displays overlaid onto the app window.

As most of you probably already knew it's impossible for a windows app to have transparent child windows (autoit excluded). I learned by beating my head on it for days and finally running across some docs on MSDN that clearly state this.

Because the HUD needs to behave like a child (move w/parent, disappear/restore on min/max, etc..), and I'm trying to avoid the overhead of hooking the parent and individually moving each HUD child, I thought a viable workaround would be to have an autoIt gui that was an invisible child, that was itself a parent to the HUD windows.

Then the app would take care of moving the invisible child, and the invisible child could then take care of moving it's child HUD windows.

Well, it sort of works. You can have invisible MDI children of an autoit GUI, and you can make that parent GUI the invisible child of another app and you still get the transparent children.

The problem is that while the Autoit GUI parent moves with the app parent as it should, the transparent children of the Autoit Gui don't move when the top-level parent is dragged or resized.

OK, so I thought I can trap the messages sent by the top-level parent to the autoit gui parent and then issue a winMove of 1 pixel or something to the autoit GUI parent and it will then move the transparent children.

But NO. I can't detect any messages being sent from the top-level app to the Autoit gui parent AT ALL. The child just moves without receiving any messages detectable by WinInspector.

I've tried this using an autoit Gui parent and an autoit gui child and you can see the various messages being sent from the autoit parent to an autoit child with no problem, this lack of messaging just seem to occur between this other app and the autoit gui child. But somehow the window does move, go figure.

Ok, so I tried to trap the move in the Autoit GUI loop and do the same thing, and of course I can detect the move but when I then try to move the AutoIt GUI using winMove for some reason it moves off to the right and just keeps going. I've tried various combinations of moving the window with the same result. This code is below.

$aLastPos = WinGetPos($gui_parent)

while 1

$aCurPos = WinGetPos($gui_parent)

If $aCurPos[0] <> $aLastPos[0] Or $aCurPos[1] <> $aLastPos[1] Then

WinMove($gui_parent,"",$aCurPos[0]+1,$aCurPos[1])

WinMove($gui_parent,"",$aCurPos[0]-1,$aCurPos[1])

$aLastPos = WinGetPos($gui_parent)

EndIf

ToolTip($aCurPos[0] & ", " & $aCurPos[1] & @CR & $aLastPos[0] & ", " & $aLastPos[1])

sleep(500)

wend

Anyone have any ideas on how to solve this problem, or another way to accomplish this?

Share this post


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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.