📄 processinfo.cpp
字号:
/*
+------------------------------------------------------------+
| |
| (c) Copyright 2002, bigwhite, Inc. |
| |
| ALL RIGHTS RESERVED |
| |
+------------------------------------------------------------+
*/
/*==================================================================*
* ProcessInfo.cpp: implementation of the CProcessInfo class. | |
* Version 1.1 |
*=================================================================*/
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "processdir.h"
#include "ProcessInfo.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CProcessInfo::CProcessInfo(DWORD dwFlags,DWORD dwProcessID)
{m_hSnapshot=INVALID_HANDLE_VALUE;
CreateSnapshot(dwFlags,dwProcessID);
}
CProcessInfo::~CProcessInfo()
{
if(m_hSnapshot!=INVALID_HANDLE_VALUE)
CloseHandle(m_hSnapshot);
}
BOOL CProcessInfo::CreateSnapshot(DWORD dwFlags,DWORD dwProcessID)
{
if(m_hSnapshot!=INVALID_HANDLE_VALUE)
CloseHandle(m_hSnapshot);
if(dwFlags==0){m_hSnapshot=INVALID_HANDLE_VALUE;}
else{m_hSnapshot=CreateToolhelp32Snapshot( dwFlags,dwProcessID);}
return(m_hSnapshot!=INVALID_HANDLE_VALUE);
}
BOOL CProcessInfo::ProcessFirst(PPROCESSENTRY32 ppe)const
{BOOL fOk=Process32First(m_hSnapshot,ppe);
if(fOk&&(ppe->th32ProcessID==0))
fOk=ProcessNext(ppe);
return(fOk);
}
BOOL CProcessInfo::ProcessNext(PPROCESSENTRY32 ppe)const
{
BOOL fOk=Process32Next(m_hSnapshot,ppe);
if(fOk&&(ppe->th32ProcessID==0))
fOk=ProcessNext(ppe);
return(fOk);
}
BOOL CProcessInfo::ThreadFirst(LPTHREADENTRY32 lpte)const
{BOOL fOk=Thread32First(m_hSnapshot,lpte);
if(fOk&&(lpte->th32OwnerProcessID==0))
fOk=ThreadNext(lpte);
return fOk;
}
BOOL CProcessInfo::ThreadNext(LPTHREADENTRY32 lpte)const
{BOOL fOk=Thread32Next(m_hSnapshot,lpte);
if(fOk&&(lpte->th32OwnerProcessID==0))
fOk=ThreadNext(lpte);
return fOk;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -