获得进程快照的源代码
-- flyli
//information的四个数组成员分别获得了进程号,进程名,线程数,父进程号四个信息
void processFlash()
{
HANDLE snapshot ;
PROCESSENTRY32 processinfo ;
processinfo.dwSize = sizeof (processinfo) ;
snapshot = CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0) ;
if (snapshot == NULL)
return ;
BOOL status = Process32First (snapshot, &processinfo) ;
while (status)
{
CString information[4];
CString Temp;
information[0].Format("%d",processinfo.th32ProcessID);
information[1] = processinfo.szExeFile;
information[2].Format("%d",processinfo.cntThreads);
information[3].Format("%d",processinfo.th32ParentProcessID );
status = Process32Next (snapshot, &processinfo) ;
}
}