SetWindowPos is used to actually set it as always on top. I want to know if it already is. I'm thinking I need to check its z-order or something, but I don't know how.
Printable View
SetWindowPos is used to actually set it as always on top. I want to know if it already is. I'm thinking I need to check its z-order or something, but I don't know how.
WindowStyle if I'm correct.. GetForegroundWindow and check the hwnd for style properties.
Thanks. I should have thought of that. You still need to use SetWindowPos to actually make it on top (SetWindowLong doesn't work) but you can get/set a flag saying whether it is always on top.
In case anyone's wondering it is 0x8h.
There is one slight bug in it though; Modal windows of Foreground apps might be seen as the most-top window. so make sure you pick the parent if you have modals ;)
That's strange, I notice (with Spy++) that a topmost window has 0x8h set for both GWL_STYLE and GWL_EXSTYLE (where it is WS_EX_TOPMOST). Weird.
How can I check if it is modal (as opposed to topmost only)?
Ehe, now that's a good one.. So far the only thing I could get working with a 80% probability is to check the parent and check the parent if it also has TOPMOST. If so, you got a modal window on top of a TOP_MOST window.
I made two forms, set one as topmost and then launched the other one as modal, and it came out behind the topmost one :confused:
Lol, I had that problem soo many times :D
You'll have to set the TOP_MOST for the Modal window too in the on_load.
That's what I though. Therefore, following that logic, shouldn't checking if WS_EX_TOPMOST is set always return a correct result?
Not 100% sure if it always returns the correct value. I always check both properties just to be really sure :)
All I have is the window handle. I'm creating a window class for easy access to VB form-style properties for any window :)
The window handle is the key to a lot of stuff, just check if it has children or parents that remain within the ThunderMain :)