In my useful hotkeys program, i have a global hotkey which sets your current foreground window to be Topmost/Not topmost by calling
SetWindowPos(hwnd, HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
SetWindowPos(hwnd, HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
at the moment i have to have two separate hotkeys, Win+Z to set window to TOPMOST anjd Win+X to set window to NOTOPMOST.
I can't find a function in MSDN which lets you check the windows z order.. i was hoping for something like GetWindowOrder, but there isn't. I also tried checking the windows ex flags like so:
dwExStyles & WS_EX_TOPMOST
but it seems that flag isn't never changed, it just tells the window to set itself topmost when its first created.
Is there a function to check this?
To make the active window always on top, press Ctrl + Spacebar (or the keyboard shortcut you assigned). Press the keyboard shortcut again to disable “always on top” for the active window.
In order to pin a window, right-click on the icon in your tray again and enter Pin Mode. Your cursor will change to a pin – click on the title bar of the window you want to always keep on top, and a pin will appear on that bar. It'll be the color you set in the options menu earlier.
Select Start , scroll to the app you want to pin, then press and hold (or right-click) the app. Select More > Pin to taskbar. If the app is already open on the desktop, press and hold (or right click) the app's taskbar icon, and then select Pin to taskbar.
Always On Top forces selected windows to stay on top. It's free, it's easy, and it works. I tested it on my Windows 7 x64 machine. Just run the utility, click the window you want to keep on top, then press Ctrl-Space.
I think you can do this:
DWORD dwExStyle = ::GetWindowLong(m_hWnd, GWL_EXSTYLE);
if ((dwExStyle & WS_EX_TOPMOST) != 0)
{
// do stuff
}
Here's the MSDN link - http://msdn.microsoft.com/en-us/library/ms633584(VS.85).aspx
And here's the MSDN link to the extended styles - http://msdn.microsoft.com/en-us/library/ff700543(v=VS.85).aspx - topmost is currently listed as "TBD" :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With