Nasty gotcha: Positioning your window beneath a topmost window makes it topmost

This post has been republished via RSS; it originally appeared at: Microsoft Developer Blogs - Feed.

There's a nasty gotcha with the Defer­Window­Pos function, and therefore any functions built on top of it, such as Set­Window­Pos: If you specify a hwndInsertAfter, and the insert-after window is topmost, then the window being positioned will be placed immediately after that window.

So far so good.

The hidden gotcha is that the window will be placed in the same zone as the insert-after window, which is the topmost zone.

In other words, the window will be made topmost, even if it wasn't topmost previously.

Which is probably not what you were expecting.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.