MSDN对此解释如下:
cntUsage
Number of references to the process. A process exists as long as its usage count is nonzero. As soon as its usage count becomes zero, a process terminates.
可是我用程序看到的这个值对所有进程的数值都是0,对此变量如何解释,望各位指教
HANDLE hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hProcessSnap == INVALID_HANDLE_VALUE)
{
return false;
}
PROCESSENTRY32 pe32 = {0} ;
pe32.dwSize = sizeof ( pe32 ) ;
if (Process32First(hProcessSnap, &pe32))
{
do
{
CString str , str1 ;
str = pe32.szExeFile ;
str1.Format ( "%d" , pe32.cntUsage ) ;
str.Insert ( str.GetLength () , str1 ) ;
MessageBox ( str ) ;
} while (Process32Next(hProcessSnap, &pe32));
}
cntUsage
Number of references to the process. A process exists as long as its usage count is nonzero. As soon as its usage count becomes zero, a process terminates.
可是我用程序看到的这个值对所有进程的数值都是0,对此变量如何解释,望各位指教
HANDLE hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hProcessSnap == INVALID_HANDLE_VALUE)
{
return false;
}
PROCESSENTRY32 pe32 = {0} ;
pe32.dwSize = sizeof ( pe32 ) ;
if (Process32First(hProcessSnap, &pe32))
{
do
{
CString str , str1 ;
str = pe32.szExeFile ;
str1.Format ( "%d" , pe32.cntUsage ) ;
str.Insert ( str.GetLength () , str1 ) ;
MessageBox ( str ) ;
} while (Process32Next(hProcessSnap, &pe32));
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货