Get the priority of an open process
#include <Process.au3>
_ProcessGetPriority ($i_PID)
Parameters
$i_PID | Process ID (Int) of process to be examined. |
Return Value
Success: | Returns integer corressponding to the processes's priority: |
0 - Idle/Low | |
1 - Below Normal (Not supported on Windows 95/98/ME) | |
2 - Normal | |
3 - Above Normal (Not supported on Windows 95/98/ME) | |
4 - High | |
5 - Realtime | |
Failure: | Returns -1 and sets @Error to 1 |
Remarks
None.
Related
ProcessSetPriority
Example
#include<process.au3>
Dim $i_Priority_Level, $i_Notepad_PID, $i_ArrayItem
Dim $a_RunLevels[3] = [0, 2, 4] ;low, normal, high priorities
;Get Priority Level of this instance of AutoIt Scripting Engine
$i_Priority_Level = _ProcessGetPriority (@AutoItPID)
MsgBox(0, "AutoIt Script", "Should be 2: " & $i_Priority_Level)
$i_Notepad_PID = Run(@ComSpec & ' /k notepad.exe', '', @SW_HIDE)
For $i_ArrayItem = 0 To 3
ProcessSetPriority($i_Notepad_PID, $a_RunLevels[$i_ArrayItem])
$i_Priority_Level = _ProcessGetPriority ($i_Notepad_PID)
MsgBox(0, "Notepad Priority", "Should be " & $a_RunLevels[$i_ArrayItem] & ": " & $i_Priority_Level)
Next
ProcessClose('notepad.exe')