Advertisement

Stay-on-top windows

Started by November 04, 2006 06:01 PM
3 comments, last by Colin Jeanne 17 years, 11 months ago
Does anyone know the correct way to create a stay-on-top window as a subwindow in a Win32 API application? If I create the subwindow and specify WS_EX_TOPMOST to CreateWindowEx, it works but the subwindow even then stays on top of other applications as well if I switch to them. I'm after something more like Paint Shop Pro's tool windows which stay on top of any other PSP windows but not on top of other application windows. Is there any way to get this behaviour by a way of setting up the window? Thanks.
Handling WM_ACTIVATEAPP might help with preventing sub-windows from staying on top of other application windows.

Have you tried WS_EX_TOOLWINDOW?
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
Advertisement
WS_EX_TOOLWINDOW did the trick. Thanks very much indeed. I've lost the little icon and the system menu but that doesn't really matter. Nice simple solution I was looking for.
I don't mean to hijack this topic, but my question is pretty similar. PSP like tool windows. Setting them als 'tool window' in the resource editor (which I assume is the same as WS_EX_TOOLWINDOW) works perfectly, but I would also like the windows to stay inside the main program window (does that make sense?). I figured the tool windows would need to be child windows of the parent then, but setting them as child windows kind of messes up the staying-on-top-all-the-time, since certain parts of the main (parent) window get drawn over the tool window. Is there another simple way of achieving the effect of keeping the tool windows inside the main window, without writing relatively complex functions to ensure this effect?
From what I remember of PSP it was an MDI program. The tool windows would therefore be MDI child windows with WS_EX_TOOLWINDOW specified.

WinProg on MDI
MSDN on MDI

This topic is closed to new replies.

Advertisement