Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how can I keep top-level windows in their relative z-order

200 views
Skip to first unread message

Gerry Suggitt

unread,
Mar 17, 2008, 2:26:02 PM3/17/08
to
A top level window will come to the top of the z-order (here I am assuming no
always-on-top windows) when activated, say by clicking on it.

But the owner of a top-level window will never be brought above its owned
windows.

Does anyone know of a simple way to prevent the top-level windows of an
application from changing their z-order when activated?

Why do I want to do this? I have an application that allows transparent
Flash controls. As you know, transparent Flash control must be housed in a
top-level window (Actually, they must be housed in a WS_EX_LAYERED window and
a WS_EX_LAYERED window must be top-level.)

There is nothing that would prevent someone from creating 2 Flash controls -
one acting as the background and the other supplying buttons. In fact, this
is very likely. The buttons Flash could be placed over the background flash.
If the user where to click the background it would come to the front and hide
the buttons.

I want to prevent the background from coming to the top.

I thought that SetParent might do the trick, but unfortunately as well as
setting ownership it restricts the ownee to the area defined by the owner.
This would work for my example above, but in general I could not restrict the
user from defining a Flash control that extends beyond the area of the
background Flash.

I have also tried WM_WINDOWPOSCHANGING but to no avail. The code just got
hoary and never worked properly. I would OR in the SWP_NOZORDER bit, but the
z-order changed anyway. Or I tried changing the hwndInsertAfter, with no luck.

Any thoughts?

Somebody

unread,
Mar 17, 2008, 10:04:50 PM3/17/08
to
Just trap the WM_MOUSEACTIVATE and return MA_NOACTIVATEANDEAT. This will
prevent the window from being activated when a user clicks on it. There are
a few gotchas when you don't activate a window, but I leave that for you to
explore :).

"Gerry Suggitt" <GerryS...@discussions.microsoft.com> wrote in message
news:C61590E0-DE8D-4302...@microsoft.com...

Gerry Suggitt

unread,
Mar 19, 2008, 3:57:00 PM3/19/08
to
Well, that does keep the deeper Flash from coming to the fore ....

but

(1) If an another application window is over the flash window, clicking on
the flash window will not bring the flash application windows above the other
application's windows (as would be the normal operation)

(2) I want the controls in the flash window to be activated. If the flash
control contains a text box, for example, and I click on the text box, I need
to have the text box become active and ready to accept input from the
keyboard.

Problem (1) is readily fixed with a call to ShowWindow of the root window of
the flash window with a argument of SW_SHOWNA

Problem (2) has no fix that I can think of

0 new messages