My Application goes to Service Session (instead of console)
<p>I write a service and want to run an application (with GUI) from it. So I write a procedure like below. my application start but still in service session! and so i can't see it's GUI.<br>
Any help please.</p>

<pre><code>Procedure RunAppFromService(Path, FileName: string);
var
  zPath          : array[0..512] of char;
  zAppName          : array[0..512] of char;
  StartupInfo       : TStartupInfo;
  ProcessInfo       : TProcessInformation;
begin { WinExecAndWait32V2 }
  StrPCopy(zPath, Path);
  StrPCopy(zAppName, FileName);

  FillChar(StartupInfo, Sizeof(StartupInfo), #0);
  StartupInfo.cb := Sizeof(StartupInfo);
  StartupInfo.lpDesktop := PChar('winsta0\Default');
  StartupInfo.dwFlags := STARTF_USESHOWWINDOW;
  StartupInfo.wShowWindow := Visibility;

  FillChar(ProcessInfo, Sizeof(ProcessInfo), #0);

  CreateProcessAsUser(0, nil,
    zAppName, { pointer to command line string }
    nil, { pointer to process security attributes }
    nil, { pointer to thread security attributes }
    false, { handle inheritance flag }
    CREATE_NEW_CONSOLE or { creation flags }
    NORMAL_PRIORITY_CLASS,
    nil, { pointer to new environment block }
    zPath, { pointer to current directory name }
    StartupInfo, { pointer to STARTUPINFO }
    ProcessInfo); { pointer to PROCESS_INF }
end;
</code></pre>