BOOL SetThreadPriority( HANDLE hThread, int nPriority );Priority Meaning THREAD_PRIORITY_ABOVE_NORMAL Priority 1 point above the priority class. THREAD_PRIORITY_BELOW_NORMAL Priority 1 point below the priority class. THREAD_PRIORITY_HIGHEST Priority 2 points above the priority class. THREAD_PRIORITY_IDLE Base priority of 1 for IDLE_PRIORITY_CLASS, BELOW_NORMAL_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, ABOVE_NORMAL_PRIORITY_CLASS, or HIGH_PRIORITY_CLASS processes, and a base priority of 16 for REALTIME_PRIORITY_CLASS processes. THREAD_PRIORITY_LOWEST Priority 2 points below the priority class. THREAD_PRIORITY_NORMAL Normal priority for the priority class. THREAD_PRIORITY_TIME_CRITICAL Base priority of 15 for IDLE_PRIORITY_CLASS, BELOW_NORMAL_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, ABOVE_NORMAL_PRIORITY_CLASS, or HIGH_PRIORITY_CLASS processes, and a base priority of 31 for REALTIME_PRIORITY_CLASS processes
用这个函数 BOOL SetPriorityClass( HANDLE hProcess, // handle to process DWORD dwPriorityClass // priority class ); 把进程的Priority Class设成REALTIME_PRIORITY_CLASS
提高优先级到实时,
怎么做的?
兄台有具件的API函数吗?
HANDLE hThread,
int nPriority
);Priority Meaning
THREAD_PRIORITY_ABOVE_NORMAL Priority 1 point above the priority class.
THREAD_PRIORITY_BELOW_NORMAL Priority 1 point below the priority class.
THREAD_PRIORITY_HIGHEST Priority 2 points above the priority class.
THREAD_PRIORITY_IDLE Base priority of 1 for IDLE_PRIORITY_CLASS, BELOW_NORMAL_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, ABOVE_NORMAL_PRIORITY_CLASS, or HIGH_PRIORITY_CLASS processes, and a base priority of 16 for REALTIME_PRIORITY_CLASS processes.
THREAD_PRIORITY_LOWEST Priority 2 points below the priority class.
THREAD_PRIORITY_NORMAL Normal priority for the priority class.
THREAD_PRIORITY_TIME_CRITICAL Base priority of 15 for IDLE_PRIORITY_CLASS, BELOW_NORMAL_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, ABOVE_NORMAL_PRIORITY_CLASS, or HIGH_PRIORITY_CLASS processes, and a base priority of 31 for REALTIME_PRIORITY_CLASS processes
BOOL SetPriorityClass(
HANDLE hProcess, // handle to process
DWORD dwPriorityClass // priority class
);
把进程的Priority Class设成REALTIME_PRIORITY_CLASS
BOOL CPriorityTestApp::InitInstance()
{
AfxEnableControlContainer();
SetPriorityClass(GetCurrentProcess(),REALTIME_PRIORITY_CLASS);
......}
再看进程管理器里面的优先级显示实时的了