2012-05-31 5 views

ответ

3

WINAPI есть функция CreateProcess(), которая позволяет спецификации приоритета:

 
dwCreationFlags [in] 

    The flags that control the priority class and the creation of the process. 
For a list of values, see Process Creation Flags. 

    This parameter also controls the new process's priority class, which 
is used to determine the scheduling priorities of the process's threads. 
For a list of values, see GetPriorityClass. If none of the priority class 
flags is specified, the priority class defaults to NORMAL_PRIORITY_CLASS 
unless the priority class of the creating process is IDLE_PRIORITY_CLASS 
or BELOW_NORMAL_PRIORITY_CLASS. In this case, the child process receives 
the default priority class of the calling process. 
2

Вы можете использовать SetThreadPriority() на главном потоке приложения

1

Я думаю, что это более полный ответ:

Три различных варианта (это не шаги):

  • Во время CreateProcess укажите приоритет процесса CLASS (приоритеты отдельных потоков выводятся из класса приоритета процесса).
  • После запуска приложения используйте SetPriorityClass. Это позволяет по желанию изменить приоритет CLASS.
  • Изменение приоритетов отдельных потоков с помощью SetThreadPriority. Они идут вверх и вниз в соответствии с «базовым» приоритетом CLASS.

Дополнительную информацию см. В MSDN.

Смежные вопросы