I have a window which i would like to display above everything else. My code is able to successfully force it to be above almost every window, except for other top-most windows. Here is the code I use:
SetWindowPos(getSDLWindow(),HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
This line is executed every time I click the middle mouse button (I am using a mouse hook to fire it).
Once I start up my program, and middle-click once, from that point on, my window remains above all "regular" windows.
However, all "special windows" seem to be in the same category as my application window, i.e. special windows when focused are displayed above my application window. In this category of special windows are the taskbar (which using the start menu also seems to activate), right-click menus (even when spawned by regular windows), the Task Manager, and I am sure many others. In fact I am fairly sure any other window which is "topmost" will behave this way. It seems that through my SetWindowPos
call I have elevated the status of my application window to a topmost window.
What's neat is that I can start the Task Manager, move it over my app window (so that it is now covering it) and then middle-click inside the Task Manager, and now my app window pops back up in front (while focus remains on the Task Manager). This is nice but I'd like to take it one step further so that my window will be on top no matter what.
Are there any methods to accomplish this other than repeatedly firing SetWindowPos
in a loop? I'd like to avoid that if at all possible.