Click to See Complete Forum and Search --> : Child Window topmost


The_Judgement
April 3rd, 2009, 07:50 AM
Hi, I'm trying to get a child window to be topmost, really is a modeless dialog box, above other normal child windows. When I create the dialog box, I call SetWindowPos:

SetWindowPos(hToolsDlg, HWND_TOPMOST, 0,0,0,0, SWP_NOSIZE | SWP_NOMOVE);

but when another child window moves or get active, it get above dialog box. I don't know why happens that.
The style of de dialog box is:

WS_SYSMENU | WS_VISIBLE | WS_CHILD | WS_EX_PALETTEWINDOW | WS_CLIPSIBLINGS

and the style of the normal child window is:

WS_CHILD | WS_VISIBLE | WS_OVERLAPPEDWINDOW

Thanks.

ckweius
April 6th, 2009, 04:08 AM
Hi, may be you should check this out.

LockSetForegroundWindow() (http://msdn.microsoft.com/en-us/library/ms633532(VS.85).aspx)

Regards,
Kevin Choong

ovidiucucu
April 6th, 2009, 04:10 AM
SetWindowPos(hWnd, HWND_TOPMOST... adds WS_EX_TOPMOST style.
WS_EX_TOPMOST applies only to top-level windows and not for the child ones.

Note: child windows have the WS_CHILD style set; all others are top-level windows.

[ later edit ]
In other words: topmost can be only the toplevel windows.

The_Judgement
April 6th, 2009, 06:10 PM
Thanks for reply.

So, that means with that function and with the ES_EX_PALETTEWINDOW style I can do that.

Anyone knows how to get a child window stay above other child windows? I've seen that in a program, Icofx, but I don't know how can I get that in C.

Thanks.