DWORD arr[1024] = {0}; DWORD nCount = 1024; if (!EnumProcesses(arr, sizeof(arr), &nCount)) { CDialog::OnOK(); return ; } nCount = nCount / sizeof(DWORD); for (DWORD i = 0; i < nCount; i++) { HANDLE hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, arr[i] ); TRACE1("%da/n", GetLastError()); if (!hProcess) continue; char buf[2048] = {0}; DWORD nRec = GetModuleFileNameEx(hProcess, 0, buf, 1024); if (!nRec) { TRACE1("%db/n", GetLastError()); } CloseHandle(hProcess); } 需要注意的是:GetModuleFileNameEx与GetModuleFileName的区别,前者可查找指定进程以及指定进程指定模块路径,后者只能查找当前进程的模块路径