Window message sent to my topmost form/window when the taskbar/start menu is over it?

889 views Asked by At

I have a C# Windows Forms program, in Windows 7, but I think it applies to any Windows program.

The main form of my program covers the entire screen, and has the Topmost property set. However, when I click the Start key to open the Start menu for example, the taskbar and Start Menu are displayed, on top of my Always on Top form.

Is there a window message (WM_) that is sent to my form/window when this happens and my form/window is no longer the topmost window (or on top of the Z-order)? I'd like to catch it using WndProc.

Thank you

2

There are 2 answers

1
rene On BEST ANSWER

I think it is wise to consume Raymond Chen his blog post and although it feels like just a fun story, take it very, very serious.

Quote: "When two programs "duke it out" like this, you can't predict which one will win, but you can predict with 100% certainty who will lose: The user. "

0
silverspoon On

As rene said in above post, it is going to be a race condition if more than 1 applications are going to use the same logic, but if you still want to do it, I think having a look at Form.Deactivated will be a good start.