Process32First挑错
程序代码:
#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; }