搞了一下午了,反反复复都是自己的错,要不就是{没写,要不就是字母错误,多亏了群里的朋友帮忙,哎...
语法错误啊语法错误,好在一下午没白费,搞好了,看来和编译器也没啥关系嘛,以后还是多尝试在vs2019编译好了
自从用vc++ 6.0 我就老是出低级错误...

#include<windows.h>
#include<tlhelp32.h>
#include<iostream>
int main(int argc, char* argv[])
{
PROCESSENTRY32 pe32;
pe32.dwSize = sizeof(pe32);

HANDLE hProcessSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hProcessSnap == INVALID_HANDLE_VALUE)
{
    printf("CreateToolhelp32Snapshort调用失败!\n");
    return -1;
}
BOOL bMore = ::Process32First(hProcessSnap, &pe32);
while (bMore)
{
    printf("进程名称: %s\n", pe32.szExeFile);
    printf("进程ID号: %d \n", pe32.th32ProcessID);


    bMore = ::Process32Next(hProcessSnap, &pe32);
}
//getchar();
::CloseHandle(hProcessSnap);
return 0;
}
最后修改:2022 年 12 月 05 日
如果觉得我的文章对你有用,请随意赞赏