Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Roger Lipscombe's answer, to use <a href="http://msdn.microsoft.com/en-us/library/aa383833.aspx" rel="noreferrer">WTSEnumerateSessions</a> to find the right desktop, then <a href="http://msdn.microsoft.com/en-us/library/ms682429.aspx" rel="noreferrer">CreateProcessAsUser</a> to start the application on that desktop (you pass it the handle of the desktop as part of the <a href="http://msdn.microsoft.com/en-us/library/ms686331.aspx" rel="noreferrer">STARTUPINFO</a> structure) is correct.</p> <p>However, I would <i>strongly</i> recommend against doing this. In some environments, such as Terminal Server hosts with many active users, determining which desktop is the 'active' one isn't easy, and may not even be possible.</p> <p>But most importantly, if an application will suddenly appear on a user's desktop, this may very well occur at a bad time (either because the user simply isn't expecting it, or because you're trying to launch the app when the session isn't quite initialized yet, in the process of shutting down, or whatever).</p> <p>A more conventional approach would be to put a shortcut to a small client app for your service in the global startup group. This app will then launch along with every user session, and can be used start other apps (if so desired) without any juggling of user credentials, sessions and/or desktops.</p> <p>Also, this shortcut can be moved/disabled by administrators as desired, which will make deployment of your application much easier, since it doesn't deviate from the standards used by other Windows apps...</p>
 

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