进程快照

    xiaoxiao2025-09-03  18

    #include <windows.h> #include <iostream> #include <string> #include<TlHelp32.h> using namespace std;

    int main(int argc, char* argv[]) {          PROCESSENTRY32 pe32;     ZeroMemory(&pe32, sizeof(pe32));     pe32.dwSize = sizeof(pe32);     HANDLE hAndle =  ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);     if (hAndle != INVALID_HANDLE_VALUE)     {         int i = 0;         BOOL BeMore = Process32First(hAndle, &pe32);         while (BeMore)         {             ++i;             cout << "Execute Name: "<<pe32.szExeFile << endl;             cout << "Process ID: " << pe32.th32ProcessID << endl;             cout << endl;             BeMore = Process32Next(hAndle, &pe32);         }         cout << "All Process Count: " << i << endl;     }

       CloseHandle(hAndle);     system("pause");     return 0; }   

    最新回复(0)