Einzelnen Beitrag anzeigen

DRPEnc

Registriert seit: 20. Feb 2004
Ort: Noch unterm Mond
126 Beiträge
 
#22

Re: Process Priorität setzen - als Variable...

  Alt 19. Mär 2004, 23:03
Delphi-Quellcode:
function RunProcess(FileName: string; ShowCmd: DWORD; wait: Boolean; ProcID: PDWORD): Longword;
var
  StartupInfo: TStartupInfo;
  ProcessInfo: TProcessInformation;
begin
  FillChar(StartupInfo, SizeOf(StartupInfo), #0);
  StartupInfo.cb := SizeOf(StartupInfo);
  StartupInfo.dwFlags := STARTF_USESHOWWINDOW or STARTF_FORCEONFEEDBACK;
  StartupInfo.wShowWindow := ShowCmd;
  if not CreateProcess(nil,
    @Filename[1],
    nil,
    nil,
    False,
    CREATE_NEW_CONSOLE or
    NORMAL_PRIORITY_CLASS,
    nil,
    nil,
    StartupInfo,
    ProcessInfo)
    then
      Result := WAIT_FAILED
  else
  begin
    if wait = FALSE then
    begin
      if ProcID <> nil then ProcID^ := ProcessInfo.dwProcessId;
      exit;
    end;
    WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
    GetExitCodeProcess(ProcessInfo.hProcess, Result);
  end;
  if ProcessInfo.hProcess <> 0 then
    CloseHandle(ProcessInfo.hProcess);
  if ProcessInfo.hThread <> 0 then
    CloseHandle(ProcessInfo.hThread);
end;
if not CreateProcess(nil,
@Filename[1],
nil,
nil,
False,
CREATE_NEW_CONSOLE or
NORMAL_PRIORITY_CLASS,
nil,
nil,
StartupInfo,
ProcessInfo)
then

Ich muss die ROTE Zeile irgendwie als Variable haben. Nur wie? Wenn ich statt NORMAL_PRIORITY_CLASS IDLE_PRIORITY_CLASS schreibe ist die Anwendung in der IDLE_PRIORITY_CLASS. Nur will ich das per Combobox verändern können.
CU

DRPEnc
  Mit Zitat antworten Zitat