
24.01.2012, 12:52
|
Новичок
|
|
Регистрация: 28.07.2009
Сообщения: 85
Репутация: 50
|
|
Установка приоритета
Код:
procedure TForm1.Button1Click(Sender: TObject);
const
ABOVE_NORMAL_PRIORITY_CLASS = $00008000;
BELOW_NORMAL_PRIORITY_CLASS = $00004000;
var
ProcessHandle: THandle;
begin
ProcessHandle := OpenProcess(PROCESS_SET_INFORMATION, True, StrToInt(Edit1.Text));
if ProcessHandle <> 0 then
begin
try
if not SetPriorityClass(ProcessHandle, HIGH_PRIORITY_CLASS) then
ShowMessage('Невозможно установить приоритет процессу (' + Edit1.Text + ')');
finally
CloseHandle(ProcessHandle);
end;
end
else
begin
ShowMessage('Невозможно открыть процесс (' + Edit1.Text + ')');
end;
end;
|