//Show threads in the process
AddText(hwnd,TEXT("\r\nThread Information:\r\n")TEXT(" TID Priority\r\n"));
THREADENTRY32 te={sizeof(te)};
fOK=th.ThreadFirst(&te);
for(;fOK;fOK=th.ThreadNext(&te))
{
if(te.th32OwnerProcessID==dwProcessID)
{
int nPriority=te.tpBasePri+te.tpDeltaPri;
//下面4行代码为什么这么写?
if ((te.tpBasePri < 16) && (nPriority > 15)) nPriority = 15;
if ((te.tpBasePri > 15) && (nPriority > 31)) nPriority = 31;
if ((te.tpBasePri < 16) && (nPriority < 1)) nPriority = 1;
if ((te.tpBasePri > 15) && (nPriority < 16)) nPriority = 16;
AddText(hwnd,TEXT(" %08X %2d\r\n"),te.th32ThreadID,nPriority);
}
}
AddText(hwnd,TEXT("\r\nThread Information:\r\n")TEXT(" TID Priority\r\n"));
THREADENTRY32 te={sizeof(te)};
fOK=th.ThreadFirst(&te);
for(;fOK;fOK=th.ThreadNext(&te))
{
if(te.th32OwnerProcessID==dwProcessID)
{
int nPriority=te.tpBasePri+te.tpDeltaPri;
//下面4行代码为什么这么写?
if ((te.tpBasePri < 16) && (nPriority > 15)) nPriority = 15;
if ((te.tpBasePri > 15) && (nPriority > 31)) nPriority = 31;
if ((te.tpBasePri < 16) && (nPriority < 1)) nPriority = 1;
if ((te.tpBasePri > 15) && (nPriority < 16)) nPriority = 16;
AddText(hwnd,TEXT(" %08X %2d\r\n"),te.th32ThreadID,nPriority);
}
}
解决方案 »
- 内存泄露的疑问
- 结构大小的问题。 高手入。
- 有办法枚举局域网内的Oracle数据库服务器吗?有办法枚举指定Oracle数据库服务器上的数据库结构(比如枚举方案)吗?
- 救命:WSAAsyncSelect( listensocket,this->m_hWnd,UM_SOCKREC,FD_ACCEPT)中的this->m_hWnd错误,如何获得ActiveX的HWND,在线等待,马上给
- VC程序员
- 哪里有 iphlpapi.h 可以download?
- 问题求救:我的程序运行一段时间,屏幕就花了,请高手帮帮忙!(解决问题给600分,参与有分)
- 怎样在程序中动态改变工具栏按钮图标(ICON)?
- 锁键盘和鼠标。为什么在NT Service中不能正常运行???
- C++程序,release的exe,开发者自己的机器能够运行,别的机器运行时出错死掉的可能原因都会有啥?
- setwindowshookex卸载后再次调用失败
- 元文件保存的问题,(另一个程序正在使用此文件,进程无法访问)
tpBasePri
Initial priority level assigned to a thread. This member can be one of the following values: Value Meaning
THREAD_PRIORITY_IDLE Indicates a base priority level of 1 for IDLE_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, or HIGH_PRIORITY_CLASS processes, and a base priority level of 16 for REALTIME_PRIORITY_CLASS processes.
THREAD_PRIORITY_LOWEST Indicates 2 points below normal priority for the priority class.
THREAD_PRIORITY_BELOW_NORMAL Indicates one point below normal priority for the priority class.
THREAD_PRIORITY_NORMAL Indicates normal priority for the priority class.
THREAD_PRIORITY_ABOVE_NORMAL Indicates one point above normal priority for the priority class.
THREAD_PRIORITY_HIGHEST Indicates two points above normal priority for the priority class.
THREAD_PRIORITY_TIME_CRITICAL Indicates a base priority level of 15 for IDLE_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, or HIGH_PRIORITY_CLASS processes, and a base priority level of 31 for REALTIME_PRIORITY_CLASS processes. tpDeltaPri
Change in the priority level of a thread. This value is a signed delta from the base priority level assigned to the thread.