SetThreadPriority Procedure

Sets the specified thread priority.

Syntax

[ bSet = ] SetThreadPriority ( hThread, enPriority )

The SetThreadPriority property syntax has the following parts:

 

Name

Type

Description

bSet

Bool Public

A Boolean expression specifying whether the specified thread priority was set.

hThread

Val AHandle

Handle to the thread.

enPriority

Val enumAThreadPriority

An integer specifying the new thread priority level within its priority class.

Where

bSet can have one of the following values:

 

Value

Description

True *

The thread priority was set.

False

The thread priority was not set.

enumAThreadPriority:

 

Name

Value

Description

apriorityIdle

-15

Idle

apriorityLowest

-2

Lowest

apriorityBelowNormal

-1

Below Normal

apriorityNormal

0

Normal

apriorityAboveNormal

1

Above Normal

apriorityHighest

2

Highest

apriorityTimeCritical

15

Time Critical

Comments

This function sets the priority level of the current thread within its priority class. It can only be called after CreateThread successfully returns.

Example

The following statement sets the priority of the Thread1 to be normal:

bSetThreadPriority1 = SetThreadPriority(hThread1,apriorityNormal)

See Also

CreateThread, GetCurrentThread, GetThreadPriority