We already know that you can’t create a window that is always on top, even in the presence of other windows marked always-on-top. An application of the What if two programs did this? rule demonstrates that it’s not possible, because whatever trick you use to be on-top-of-always-on-top, another program can use the same trick, and now you have two on-top-of-always-on-top windows, and what happens?
A customer who failed to understand this principle asked for a way to establish their window as “super-awesome topmost”. They even discovered the answer to the “and what happens?” rhetorical question posed above.
We have overridden the OnLostFocus and OnPaint methods to re-assert the TopLevel and TopMost window properties, as well as calling BringToFront and Activate. The result is that our application and other applications end up fighting back and forth because both applications are applying similar logic. We tried installing a global hook and swallowing paint and focus events for all applications aside from our own (thereby preventing the other applications from having the opportunity to take TopMost ahead of us), but we found that this causes the other applications to crash. We’re thinking of setting a timer and re-asserting TopMost when the timer fires. Is there a better way?
This is like saying, “Sometimes I’m in a hurry, and I want to make sure I am the next person to get served at the deli counter. To do this,
!-->