title: window stations and desktops
body: <p>I am trying to launch an application on a hidden desktop but not getting much progress and can't find a detailed documentation on how what the desktops and window stations really are.  Here's my code with error handling removed (but beleive me it is there and is not catching any errors):</p>
  
  <pre><code>HWINSTA winSta = CreateWindowStation(_T("hiddenWinSta"), 0, 0, NULL);
  SetProcessWindowStation(winSta);
  HDESK desktop = CreateDesktop(_T("hiddenDesktop"), NULL, NULL, 0, DESKTOP_CREATEWINDOW, NULL);
  OpenDesktop(_T("hiddenDesktop"), 0, TRUE, GENERIC_ALL);
  SetThreadDesktop(desktop)
  
  HWINSTA r = GetProcessWindowStation();
  printf("winsta: %x %x\n", r, winSta);
  HDESK curdesk = GetThreadDesktop(GetCurrentThreadId());
  printf("desktop: %x %x\n", curdesk, desktop);
  
  STARTUPINFO si;
  PROCESS_INFORMATION pi;
  
  ZeroMemory( &amp;si, sizeof(si) );
  si.cb = sizeof(si);
  //si.lpDesktop = _T("hiddenDesktop");
  ZeroMemory( &amp;pi, sizeof(pi) );
  TCHAR szCommand[MAX_PATH];
  _sntprintf_s(szCommand, MAX_PATH, _T("%s"), _T("c:\\windows\\system32\\calc.exe"));
  DWORD res = CreateProcess(NULL, szCommand, NULL, NULL, FALSE, 0, NULL, NULL, &amp;si, &amp;pi);
  </code></pre>
  
  <p>If I uncomment the si.lpDesktop line the process fails to start with the dreaded error 0x000142.  If I comment si.lpDesktop process starts on the current desktop.
  What am I doing wrong?  Is it even possible to do what I want (i.e. launch a Windows GUI app completely invisible)?</p>