If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Hybrid View

SetPriorityClass

I am to call "SetpriorityClass (thread, ABOVE_NORMAL_PRIORITY_CLASS) and it returns with an error - invalid handle on the GetLastError(). THis same handle to the thread is used in an immediate statement pthread->SetThreadPriority and all is well.

I thought maybe I didn't have the correct values to Query and Set this in the DACL but I have not figured out how to set that easily - it is quite messy and not simple examples.

Anyway know why the SetPriorityClass does not work?If is is a permissions problem on the thread (which I create quite standardly with "afxBeginThread")?

Re: SetPriorityClass

Use GetCurrentProcess() to get a pseudo-handle of your process.
Then, call SetPriorityClass() to set the priority class for the specified process. This value together with the priority value of each thread of the process determines each thread's base priority level.
If later needed to change the priority of a single thread in your process, use SetThreadPriority().
Still need help?