Skip to main content
GameDev.net gamedev.net
🔒 Locked

[Win32] Application always on top problem

Started by dabo Jun 8, 2009 at 6:26 AM 4 replies 1.5k views
Original Post
dabo
dabo
Hello, I'm writing an editor using Win32 for my game but somehow it always stays on top. This is very annoying especially when debugging as I can't see Visual Studio because my editor is in the way. How do I disable this "always on top" behavior? I've checked the dialog properties but I can't find anything useful.
Makaan
Makaan
Hello ,
I think the function SetWindowPos can remove that.
Chack out this article: http://www.codeproject.com/KB/cpp/KeepWindowAlwaysOnTop.aspx
And the MSDN reference: http://msdn.microsoft.com/en-us/library/ms633545(VS.85).aspx


Raxvan.
ApochPiQ
ApochPiQ
Try this:

::SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);

Any time after your window is created this should permanently turn off the "always on top" status... assuming, of course, that you don't have some other piece of code turning it back on [wink]
dabo
dabo
Thanks a lot guys, works perfectly.
Daggerbot
Daggerbot
Make sure that the dwExstyle parameter passed into CreateWindowEx doesn't have the WS_EX_APPWINDOW bit set, as this causes the window to appear on top of all windows unless hidden.
ApochPiQ
ApochPiQ
Quote:
Original post by Daggerbot
Make sure that the dwExstyle parameter passed into CreateWindowEx doesn't have the WS_EX_APPWINDOW bit set, as this causes the window to appear on top of all windows unless hidden.


WS_EX_APPWINDOW controls when a window is placed on the taskbar. You're thinking of WS_EX_TOPMOST.

(Reference)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.