title: How to check whether a window is topmost?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5364063/how-to-check-if-window-is-always-on-top">How to check if window is “Always on top”?</a>  </p>
  </blockquote>
  
  
  
  <p><strong>How can I verify whether a window is topmost or not, when given a window handle within the win32 API?</strong></p>
  
  <p>By "topmost" I don't simply mean the one which is currently on top, e.g. the z-order, but whether it actually <em>stays</em> on top. I gather from the documentation <em>several</em> windows can actually be topmost.</p>
  
  <p>From the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms632681%28v=vs.85%29.aspx" rel="nofollow noreferrer"><code>DeferWindowPos</code></a> documentation on <code>HWND_NOTOPMOST</code>:</p>
  
  <blockquote>
    <p>Places the window above all non-topmost windows (that is, behind all
    topmost windows). This flag has no effect if the window is already a
    non-topmost window.</p>
  </blockquote>
  
  <p>I know how to make a window topmost, but I can't seem to find out how to check whether it <em>is</em> topmost. I can't simply keep track of the state myself since the window is already topmost before I run my application.</p>