一年多前的簡答,或許會需要用到,記錄一下。
#include <windows.h> #include <tlhelp32.h> using namespace System; int main (array<String^>^) { HANDLE hProcs = CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0); if (!hProcs) return 0; PROCESSENTRY32 pe = {0}; pe.dwSize = sizeof (PROCESSENTRY32); if (Process32First (hProcs, &pe)) do Console::WriteLine (L"PID: {0}\nName: {1}\n", pe.th32ProcessID, gcnew String (pe.szExeFile)); while (Process32Next (hProcs, &pe)); Console::ReadKey(); return 0; }
沒有留言:
張貼留言