能够获取进程的代码
2015-04-27 15:59:35 访问(1991) 赞(0) 踩(0)
#include <iostream>
#include <Windows.h>
#include "tlhelp32.h"
#include <stdio.h>
#include <string>
#include <map>
#include <atlstr.h>
using namespace std; //头文件有多,自行处理
void wcharTochar(const wchar_t *wchar, char *chr, int length)
{
WideCharToMultiByte( CP_ACP, 0, wchar, -1,chr, length, NULL, NULL );
}
int main()
{
PROCESSENTRY32 pe;
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
pe.dwSize = sizeof(PROCESSENTRY32);
if(!Process32First(hSnapshot,&pe))
return 1;
while(1)
{
pe.dwSize=sizeof(PROCESSENTRY32);
if(Process32Next(hSnapshot,&pe)==FALSE)
break;
//在这里处理开始枚举到的进程
char szExeFile[256];
wcharTochar(pe.szExeFile,szExeFile,256);
printf("%s \n",szExeFile);
}
CloseHandle(hSnapshot);
return 0;
}
标签:
能够获取进程的代码 


上一条:
下一条:
版权声明:
如果本站的资源使用了您的作品,请联系我们,我们会及时的注明
本站所有的资源均为免费自由下载,目的是让大家学习和交流
由于收集过程中几经转载,所以很多作品的原作者不详
如果您不愿在本站展示,请联系我们,我们会及时删除
相关评论
发表评论