Difference between revisions of "SetPriorityClass"
From Lazarus wiki
Jump to navigationJump to searchCringer000 (talk | contribs) (SetPriorityClass - a function that sets the priority class for a specified process.) |
m (Fixed syntax highlighting) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{set priority class}} | ||
+ | |||
SetPriorityClass - a function that sets the priority class for a specified process. This function is specific to Windows. | SetPriorityClass - a function that sets the priority class for a specified process. This function is specific to Windows. | ||
− | |||
The SetPriorityClass may have one of the following priority classes: | The SetPriorityClass may have one of the following priority classes: | ||
− | HIGH_PRIORITY_CLASS = High performs tasks immediately. | + | * HIGH_PRIORITY_CLASS <= High performs tasks immediately.<br> |
− | IDLE_PRIORITY_CLASS = Idle performs tasks when the system is idle. | + | * IDLE_PRIORITY_CLASS <= Idle performs tasks when the system is idle.<br> |
− | NORMAL_PRIORITY_CLASS = Normal performs tasks at regular speed. | + | * NORMAL_PRIORITY_CLASS <= Normal performs tasks at regular speed.<br> |
− | REALTIME_PRIORITY_CLASS = Real Time performs tasks immediately and above all other tasks, including operating system tasks. | + | * REALTIME_PRIORITY_CLASS <= Real Time performs tasks immediately and above all other tasks, including operating system tasks. |
− | Use caution when using REALTIME_PRIORITY_CLASS. It can potentially take so much of the CPU resources that there may not be anything left for other items to run, including operating system requests. | + | Use caution when using REALTIME_PRIORITY_CLASS. It can potentially take so |
− | + | much of the CPU resources that there may not be anything left for other items | |
+ | to run, including operating system requests. | ||
EXAMPLE: | EXAMPLE: | ||
− | < | + | <syntaxhighlight lang=pascal> |
uses Windows; // Unit containing the SetPriorityClass function. | uses Windows; // Unit containing the SetPriorityClass function. | ||
Line 23: | Line 25: | ||
end; | end; | ||
− | </ | + | </syntaxhighlight> |
Latest revision as of 13:40, 26 February 2020
This article applies to Windows only.
See also: Multiplatform Programming Guide
│
English (en) │
SetPriorityClass - a function that sets the priority class for a specified process. This function is specific to Windows.
The SetPriorityClass may have one of the following priority classes:
- HIGH_PRIORITY_CLASS <= High performs tasks immediately.
- IDLE_PRIORITY_CLASS <= Idle performs tasks when the system is idle.
- NORMAL_PRIORITY_CLASS <= Normal performs tasks at regular speed.
- REALTIME_PRIORITY_CLASS <= Real Time performs tasks immediately and above all other tasks, including operating system tasks.
Use caution when using REALTIME_PRIORITY_CLASS. It can potentially take so much of the CPU resources that there may not be anything left for other items to run, including operating system requests.
EXAMPLE:
uses Windows; // Unit containing the SetPriorityClass function.
procedure TForm1.FormCreate(Sender: TObject);
begin
SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
// Sets the current running application to High Priority.
end;