title: CreateProcess with Priority Parameters?
body: <p>How can I create and run a process from my program with the ability to set the priority of the process?</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>const
    LOW_PRIORITY            = IDLE_PRIORITY_CLASS;
    //BELOW_NORMAL_PRIORITY = ???
    NORMAL_PRIORITY         = NORMAL_PRIORITY_CLASS;
    //ABOVE_NORMAL_PRIROTY  = ???
    HIGH_PRIORITY           = HIGH_PRIORITY_CLASS;
    REALTIME_PRIORITY       = REALTIME_PRIORITY_CLASS;
  
  procedure RunProcess(FileName: string; Priority: Integer);
  var
    StartInfo: TStartupInfo;
    ProcInfo: TProcessInformation;
    Done: Boolean;
  begin
    FillChar(StartInfo,SizeOf(TStartupInfo),#0);
    FillChar(ProcInfo,SizeOf(TProcessInformation),#0);
    StartInfo.cb := SizeOf(TStartupInfo);
    try
      Done := CreateProcess(nil, PChar(FileName), nil, nil,False,
                            CREATE_NEW_PROCESS_GROUP + Priority,
                            nil, nil, StartInfo, ProcInfo);
      if not Done then
        MessageDlg('Could not run ' + FileName, mtError, [mbOk], 0);
    finally
      CloseHandle(ProcInfo.hProcess);
      CloseHandle(ProcInfo.hThread);
    end;
  end;
  </code></pre>
  
  <p>The above code works in that I can set the priority of the executed process. But see the image below of the Windows Task Manager:</p>
  
  <p><img src="https://i.stack.imgur.com/BfpH5.png" alt="Screenshot of Task Manager"></p>
  
  <p>You can set more options such as Below Normal and Above Normal which is what I want to also be able to set. Looking through Windows.pas I see no such value.</p>
  
  <p>How can I create and run my process with those extra parameters?</p>
  
  <p>Thanks :)</p>