procedure SetHighPriority(ProcName: String);
var
  Process32: TProcessEntry32;
  H: THandle;
  Next: Boolean;
  pID: DWORD;


begin
  Process32.dwSize:=SizeOf(Process32);
  H:=CreateToolHelp32Snapshot(TH32CS_SNAPPROCESS, 0);

 

  if Process32First(H, Process32) then begin
    repeat
      Next:=Process32Next(H, Process32);
      if Process32.szExeFile=ProcName then begin
        pID:=OpenProcess(PROCESS_ALL_ACCESS, False, Process32.th32ProcessID);
        if pID<>0 then begin
          ShowMessage('Success: '+ProcName);
          SetPriorityClass(pID, HIGH_PRIORITY_CLASS);
        end
        else
ShowMessage('Error : OpenProcess');
      end;
    until not Next;
  end;

 

  CloseHandle(pID);

  CloseHandle(H);
end;





Posted by bloodguy
,