#include <Windows.h>
#include <iostream>
#include <Tlhelp32.h>
using namespace std;int main()
{
PROCESSENTRY32 pe3 ;
pe3.dwSize = sizeof( PROCESSENTRY32 );
HANDLE Hsnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
BOOL Bresult = Process32First(Hsnap,&pe3);
while (Bresult)
{
cout<<"进程名:"<<pe3.szExeFile<<endl;//实际显示为地址,怎么不是字符串?
cout<<"进程ID:"<<pe3.th32ProcessID<<endl; Bresult = Process32Next(Hsnap,&pe3);
} Sleep(10000);
return 0;
}
#include <iostream>
#include <Tlhelp32.h>
using namespace std;int main()
{
PROCESSENTRY32 pe3 ;
pe3.dwSize = sizeof( PROCESSENTRY32 );
HANDLE Hsnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
BOOL Bresult = Process32First(Hsnap,&pe3);
while (Bresult)
{
cout<<"进程名:"<<pe3.szExeFile<<endl;//实际显示为地址,怎么不是字符串?
cout<<"进程ID:"<<pe3.th32ProcessID<<endl; Bresult = Process32Next(Hsnap,&pe3);
} Sleep(10000);
return 0;
}
解决方案 »
- VC++高手进来 有个奇怪问题
- 请问如何获取jpeg图像的灰度矩阵
- 问了好几天了都没有问出结果!在线等!!!!!!!!!!!!!!!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CWnd和HWND有什么区别?
- 我有个问题请教大家,我在用文件实现数据库功能时,各位有什么办法实现,多条件查询,具体如下
- 怎样使菜单变灰呀? 兄弟们
- 怎么换调试器?
- 不知MSDN能否下载,或在网上查阅其中的资料?
- 请问"复制“和”粘贴“还有”剪切“有消息吗?是什么消息?
- MFC事件处理--电机运动控制
- 关于socket编程的问题,无法多次使用send函数?
- 关于IsdialogMessage()函数
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),buf,wcslen(buf),NULL,NULL);
wcout<<L"进程ID:"<<pe3.th32ProcessID<<endl;
#include <iostream>
#include <Windows.h>
#include <Tlhelp32.h>using namespace std;int main()
{
PROCESSENTRY32 pe3;
pe3.dwSize = sizeof( PROCESSENTRY32 ); HANDLE Hsnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
BOOL Bresult = Process32First(Hsnap,&pe3);
setlocale(LC_ALL, "chs"); while (Bresult)
{
wcout<<_T("进程名:")<<pe3.szExeFile<<endl;//实际显示为地址,怎么不是字符串?
wcout<<_T("进程ID:")<<pe3.th32ProcessID<<endl<<endl; Bresult = Process32Next(Hsnap,&pe3);
} system("pause");
return 0;
}
wcout<<L"进程ID:"<<pe3.th32ProcessID<<endl;