Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Setting the TopMost property (or adding the WS_EX_TOPMOST style to a window) does not make it unique in the system. Any number of topmost windows may be created by any number of applications; the only guarantee is that all topmost windows will be drawn 'above' all non-topmost windows. If there are two or more topmost windows, the Z-order still applies. From your description, I suspect that flash.exe is also creating a topmost window.</p> <p>Aside from periodically forcing your window to the top of the Z-order, I think there is little you can do. Be warned, however, that this approach is dangerous: if two or more windows are simultaneously trying to force themselves to the top of the Z-order, the result will be a flickering mess that the user will likely have to use the task manager to escape.</p> <p>I recommend that your program not attempt to meddle with other processes on the computer (unless that is its explicit purpose, e.g. a task manager clone). The computer belongs to the user, and he may not value your program more highly than all others.</p> <p><strong>Addendum:</strong></p> <p>For the emergency situation described in the comments, I would look at possible solutions along these lines:</p> <ol> <li><p>How does the third party application normally get started and stopped? Am I permitted to close it the same way? If it is a service, the <a href="http://msdn.microsoft.com/en-us/library/ms685150(VS.85).aspx" rel="nofollow noreferrer">Service Control Manager</a> can stop it. If it is a regular application, sending an escape keystroke (with <a href="http://msdn.microsoft.com/en-us/library/ms646310(VS.85).aspx" rel="nofollow noreferrer">SendInput()</a> perhaps) or <a href="http://msdn.microsoft.com/en-us/library/ms632617(VS.85).aspx" rel="nofollow noreferrer">WM_CLOSE</a> message to its main window may work.</p></li> <li><p>If I can't close it nicely, am I permitted to kill it? If so, <a href="http://msdn.microsoft.com/en-us/library/ms686714(VS.85).aspx" rel="nofollow noreferrer">TerminateProcess()</a> should work.</p></li> <li><p>If I absolutely have to leave the other process running, I would try to see if I can programmatically invoke fast user switching to take me to a different session (in which there will be no competing topmost windows). I don't know where in the API to start with this one. (Peter Ruderman suggests <a href="http://msdn.microsoft.com/en-us/library/ms686347(VS.85).aspx" rel="nofollow noreferrer">SwitchDesktop()</a> for this purpose in his answer.)</p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload