Page 1 of 1
How to set run priority?
Posted: Mon Jan 22, 2007 5:07 pm
by Max
Hi,
Someone knows how to set run priority for a process launched by PB?
Run priority has 6 levels:
Real Time: 24
High: 13
Above Normal:10
Normal:8
Below Normal:6
Idle:4
How to change the process among them?
Re: How to set run priority?
Posted: Mon Jan 22, 2007 5:26 pm
by traumatic
Code: Select all
SetPriorityClass_(hProcess.l, dwPriorityClass.l)
So, to set your app's priority class to realtime for example:
Code: Select all
SetPriorityClass_(GetCurrentProcess_(), #REALTIME_PRIORITY_CLASS)
However I'm not sure if that's what you meant.
Posted: Mon Jan 22, 2007 5:48 pm
by Max
YES. I will try it.
Thx traumatic
Re: How to set run priority?
Posted: Mon Jul 16, 2007 11:00 pm
by TheCorporation
SetPriorityClass don't seem to exist under Pure Basic
Max could you give me your test result ?
Posted: Mon Jul 16, 2007 11:40 pm
by netmaestro
SetPriorityClass don't seem to exist under Pure Basic
If you are using the demo version of PureBasic, the API calls aren't available directly, which could be why you're not finding it. If that's the case, you can do it another way:
Code: Select all
#HIGH_PRIORITY_CLASS = $80
OpenLibrary(0, "kernel32.dll")
process = CallFunction(0, "GetCurrentProcess")
CallFunction(0, "SetPriorityClass", process, #HIGH_PRIORITY_CLASS)
CloseLibrary(0)