CreateProcessAsUser() not showing CreateWindow of running Process [C#]
<p>My system has 2 accounts (USER and ADMIN) and a service (Service.exe) running under LocalSystem.
The user logs into the USER account, the LocalService can then launch a process (CreateProcessAsUser(...)) as the ADMIN user.</p>

<p>The process the Service runs (Tool.exe) is a legacy C++ application that performs a job and also displays information to the user by using CreateWindow(...), but when launching it by the Service the Window does not show...</p>

<p>When the process is created by the Service I first load the Profile &amp; Environment of the ADMIN user so that the correct context is used ...
(was still hoping the Window would display to USER)</p>

<p>Now, initialy I thought this would cause a problem as ADMIN is running the process so why would the CreateWindow(...) output in the USER desktop, so I tried with a simple command-line test.exe app and when launched as ADMIN the Command Prompt window appeared - so why does that work fine where-as the CreateWindow(...) doesn't display correctly?</p>

<p>Any clues on how I can get the STATUS (using CreateWindow in Tool.exe) running under ADMIN to show in the USER logged-on session?</p>

<p>Can I use the ENVIRONMENT somehow, I tried the following thinking it might work but didn't:  </p>

<pre><code>startInfo.lpDesktop = @"WinSta0\Default";
startInfo.dwFlags = STARTF_USESHOWWINDOW;
startInfo.wShowWindow = SW_SHOW;
</code></pre>

<p>The Window is created as follows (in Tool.exe):  </p>

<pre><code>HWND hwnd = CreateWindow
(
    "Tool", 
    "Tool WINDOW",
    WS_POPUP | WS_VISIBLE,
    0,0,uWidth,uHeight,
    NULL, 
    NULL, 
    hInstance, 
    Text
);
</code></pre>

<p>Is the lpDesktop wrong (not exactly sure how this works)?</p>

<p>I know how crazy this sounds - I just would rather not have to launch another ToolDisplay.exe as USER which communicates with Tool.exe as ADMIN as a display when the Tool.exe used to handle everything on its own - so checking to see if there isn't some nice way to handle this...</p>

<p>Any help would be much appreciated...
Thanks,</p>

<p>[Simplified Question:]</p>

<p>My system has 2 accounts (USER and ADMIN), the user is always logged on as USER but at some specific times a process (Tool.exe) is launched under the ADMIN account (by a LocalSystem Service using CreateProcessAsUser(...)), almost everything works fine except for the fact that the process (Tool.exe) is supposed to display status to the user using CreateWindow(...).</p>

<p>When Tool.exe is running (as ADMIN) and the user is logged-on as USER the window is not shown (obviously)...
Is there a way to show the window of Tool.exe running under ADMIN to the user logged-on as USER?</p>

<p>Any help would be much appreciated...
Thanks,</p>
