In addtion to the foreground property, there is a second property called topmost (WS_EX_TOPMOST). The topmost property trumps the foreground property. The purpose of the topmost property is to display a critical warning message that must be visible.
However, some programmers started to abuse the topmost property. So starting (with XP I believe) Microsoft modified Windows to not honor it in some circumstances, such as the one you describe above.





by: itsmeandnobodyelsePosted on 2009-06-07 at 04:39:17ID: 24566088
>>>> First - How does Yahoo do this?
There are a few ways to achieve that, e. g. if the popup is modal it *automatically* would be top to the parent window (normally the application frame window) where it is child window of.
Other ways were to write handlers for activating windows or gaining and looosing focus and then actively force the windows to the wished behavior. But that is the more stony way and actually fights against windows standard behavior with disadvantages like flickering or hidden windows or both.
>>>> For example, if an application is newly opened, it will stop the Yahoo message from being the top.
Yes, that is the minimum what each multi-tasking windowing system must guarantee. If you overrule the defaults in that point (e. g. by adding global message hooks into the OS) you probably make a big mistake as you were levering out the fundamentals.