2012-05-31 36 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。

相关问题