GetPriorityClass

  DWORD GetPriorityClass(hProcess)    
  HANDLE hProcess; /* process to get priority for */

The GetPriorityClass function returns the priority class for the specified process.

Parameters

hProcess

Identifies the process to return the priority class for. The calling process must have PROCESS_QUERY_INFORMATION access to the process specified by hProcess when it calls this function.

Return Value

If the function is successful, the return value is the priority class of the specified process. The priority class may be one of the following values:

Value Meaning

IDLE_PRIORITY_CLASS  
  The process will only be run when the system is idle. An idle process will always be preempted by any process with a higher priority class. A screen-saver application is an example of an Idle priority process.
NORMAL_PRIORITY_CLASS  
  The process is a normal application with no special scheduling needs. This is the default priority class. Normal runnable processes will always preempt an Idle process; the idle process will only be scheduled when the normal process is blocked, and the normal process will preempt the idle process whenever the normal process can be run.
HIGH_PRIORITY_CLASS  
  The process is a high priority application. It has special scheduling needs that must be addressed in order for it to run correctly. One example of such a need would be a background application that is normally idle. In response to some external event, it needs to display a pop-up window pre-empting anything else that happens to be running in the normal or idle priority classes.
  Extreme care should be taken when using the high priority class. It is possible to create a CPU-bound application in the high priority class that can soak up nearly all available cycles.

The return value is zero if the function failed. Use the GetLastError function to obtain extended error information.

See Also

SetPriorityClass