[python-win32] Windows process priority setting question...(cross-post)

Jimmy Retzlaff jimmy at retzlaff.com
Fri Dec 17 17:30:43 CET 2004


Ray S wrote:
> Is it possible to have an app re-set its own priority, a-la task
manager?
> 
> I see that 2.4+ has the ability for sub-processes, but only on
creation.
> 
> Apparently
> win32process.SetPriorityClass(handle, dwPriorityClass)
> and
> PyCWinThread.SetThreadPriority(priority)
> allows one to change a sub while a the sub is running, but what about
the
> current?

This should do the trick:

win32process.SetPriorityClass(
                              win32process.GetCurrentProcess(),
                              win32process.IDLE_PRIORITY_CLASS
                             )

For a description of the available priority classes, see:

http://msdn.microsoft.com/library/en-us/dllproc/base/setpriorityclass.as
p

Jimmy


More information about the Python-win32 mailing list