title: CreateProcess call returns error code 50
body: <p>Try to use Createprocess to start windows Explorer in a given path, but I keep getting </p>
  
  <p><strong>System Error. Code 50. The request is not supported.</strong></p>
  
  <p>What am i doing wrong?</p>
  
  <pre><code>procedure TfrmProjectManager.OpenFolderinExplorer(const aPath: string);
    function GetWinDir: String;
    var
      Buffer: array[0..MAX_PATH] of Char;
    begin
      GetWindowsDirectory(Buffer, SizeOf(Buffer));
      SetString(Result, Buffer, StrLen(Buffer));
    end;
  
  var
    strCmdLine    : String;
    fStartInfo    : TStartupInfo;
    fProcessInfo  : TProcessInformation;
  
  begin
  
    try
      if sysutils.DirectoryExists(aPath) or 
         (MessageDlg('Folder [%s] not found. Create it?', mtConfirmation, mbYesNo, 0)=mrYes) then
      begin
        sysutils.ForceDirectories(aPath);
        FillChar(fStartInfo,sizeof(fStartInfo),0);
        FillChar(fPRocessInfo, Sizeof(fProcessInfo),0);
  
        fStartInfo.cb:=sizeof(fStartInfo);
        fStartInfo.lpReserved := nil;
        fStartInfo.lpDesktop := nil;
        fStartInfo.lpTitle := nil;
        fStartInfo.dwFlags := STARTF_USESHOWWINDOW ;
        fStartInfo.wShowWindow := SW_SHOW;
        fStartInfo.cbReserved2 := 0;
        fStartInfo.lpReserved2 := nil;
  
        strCmdLine := '"' + GetWinDir + '\explorer.exe"';
  
      if not CreateProcess(nil,PChar(strCmdLine),nil,nil,False, 0,nil,PChar(aPath),fStartInfo,fProcessInfo) then
       RaiseLastOSError;
  
    end
  
    except
      on E:TObject do
        if not IsAbortException(E) then
          raise;
    end;
  end;
  </code></pre>
  
  <p>I tried various combinations of parameters in CreateProcess, but just don't seem able to find the correct one.</p>