System Delphi

//Delphi FAQs and TIs
{The following example demonstrates changing the CPU priority given
an application. Care should be taken when changing the applications
priority, as values that are too high may cause the system to become
unresponsive. For more information, please see the Win32 help
file for the SetThreadPriority() function.}
procedure TForm1.Button1Click(Sender: TObject);
var
ProcessID : DWORD;
ProcessHandle : THandle;
ThreadHandle : THandle;
begin
ProcessID := GetCurrentProcessID;
ProcessHandle := OpenProcess(PROCESS_SET_INFORMATION,
false,
ProcessID);
SetPriorityClass(ProcessHandle, REALTIME_PRIORITY_CLASS);
ThreadHandle := GetCurrentThread;
SetThreadPriority(ThreadHandle, THREAD_PRIORITY_TIME_CRITICAL);
end;