我尝试列出当前正在运行的进程的所有名称和 ID 当我尝试计算进程的 szExeFile 时,我得到了一些奇怪的结果。这是我得到的:
Process name: 005BF3EC and id: 0
Process name: 005BF3EC and id: 4
Process name: 005BF3EC and id: 392
Process name: 005BF3EC and id: 508
Process name: 005BF3EC and id: 588
Process name: 005BF3EC and id: 596
Process name: 005BF3EC and id: 648
Process name: 005BF3EC and id: 684
Run Code Online (Sandbox Code Playgroud)
这是代码:
HANDLE ProcSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
PROCESSENTRY32 pe = {0};
pe.dwSize = sizeof(PROCESSENTRY32);
if (ProcSnap == INVALID_HANDLE_VALUE) {
cout << "Can't make a snapshot" << endl;
} …Run Code Online (Sandbox Code Playgroud)