获取进程信息
2012-05-03 14:29
155 查看
// EmunProcess.cpp : 定义控制台应用程序的入口点。 /////////////////////////////////////////////////////////////////////////////// /// /// Copyright (c) 2012 - <company name here> /// /// Original filename: EmunProcess.cpp /// Project : EmunProcess /// Date of creation : 2012-05-03 /// Author(s) : <xielechuan> /// /// Purpose : <Get the Process Information> /// /// Revisions: /// 0000 [2012-05-02] Initial revision. /// /////////////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include <Windows.h> #include <tlhelp32.h> #include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { HANDLE hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0); if (hProcessSnap == INVALID_HANDLE_VALUE) { cout<<"CreateToolHelp32Snap Failed~~"<<endl; return -1; } PROCESSENTRY32 pe32; pe32.dwSize = sizeof(PROCESSENTRY32); //遍历进程快照,显示进程的信息 BOOL bMore = Process32First(hProcessSnap,&pe32); int i =0; cout<<"PID\t"<<"线程数\t"<<"进程名称"<<endl; while (bMore) { bMore = Process32Next(hProcessSnap,&pe32); cout<<pe32.th32ProcessID<<"\t"; cout<<pe32.cntThreads<<"\t"; cout<<pe32.szExeFile<<endl; i++; } //清除snapshot对象 CloseHandle(hProcessSnap); cout<<"进程总数为"<<i<<endl; system("pause"); return 0; }
相关文章推荐
- Android - 安装及卸载应用,启动应用程序,分享,详细信息,设备进程信息获取,获取进程占用RAM,清理进程
- C#获取进程或线程相关信息的方法
- shell脚本循环调用top来获取进程的资源信息
- Android中获取进程的有关信息
- 获取进程的信息的代码
- 获取Windows系统的进程运行信息
- linux 获取进程信息
- Android中获取系统内存信息以及进程信息-----ActivityManager的使用(一)
- Android小功能 -- 获取系统内存信息以及进程信息
- 用C#获取进程信息
- 摆脱DLL"地狱"的困扰之获取进程信息
- linux获取各种进程类型的信息
- windows应用开发由浅入深(五)关于进程和线程--获取当前进程信息
- c++获取进程信息列表和进程所调用的dll列表
- windows核心编程-获取系统中进程的信息
- Solaris进程信息获取等技巧
- win32获取其它进程变量地址存放的信息
- 获取系统的进程信息
- Android中获取系统内存信息以及进程信息-----ActivityManager的使用(一)
- 获取DTLService.exe进程信息、结束进程