C# STARTUPINFO Flags to show UI for a process started from a Service in XP
<p>I'm launching a process from a windows service in XP, I'm just launching the process not trying to interact with it. The process starts but the UI does not show. I believe I need to set some flags in STARTUPINFO to make process visible, and hoping someone could show how and what flags to set.</p>

<pre><code>    sPath = @"C:\Windows\notepad.exe";

    string Message = string.Empty;

    // Variables
    PROCESS_INFORMATION processInfo = new PROCESS_INFORMATION();
    STARTUPINFO startInfo = new STARTUPINFO();

    Boolean bResult = false;
    IntPtr hToken = IntPtr.Zero;

    try
    {
        // Logon user
        bResult = LogonUser(
            "Test",
            "VirtualXP-23639",
            "test",
            LogonType.LOGON32_LOGON_INTERACTIVE,
            LogonProvider.LOGON32_PROVIDER_DEFAULT,
            out hToken
        );
        if (!bResult) { throw new Exception("Logon error #" + Marshal.GetLastWin32Error()); }

        // Create process
        startInfo.cb = Marshal.SizeOf(startInfo);
        startInfo.lpDesktop = "winsta0\\default";

        bResult = CreateProcessAsUser(
            hToken,
            null,
            sPath,
            IntPtr.Zero,
            IntPtr.Zero,
            false,
            0,
            IntPtr.Zero,
            null,
            ref startInfo,
            out processInfo
        );

        if (!bResult)
        {
            Message = "Failed to Create Process on Desktop/Console.  Code=" + Marshal.GetLastWin32Error().ToString();
            Logging.LogError(Ascension.CM.Common.Enums.ApplicationModuleEnums.Service, Message, "Ascension.CM.ServiceWorker.ProcessLauncher.XpLaunchDesktopProcess", null);
        }


    }
    finally
    {
        // Close all handles
        CloseHandle(hToken);
        CloseHandle(processInfo.hProcess);
        CloseHandle(processInfo.hThread);
    }
}
</code></pre>
