QString getProcessPathForWin(int idProcess) { #ifdef Q_OS_WIN // access process path WCHAR name[1024]; ZeroMemory(name, 1024); // open process handler HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, idProcess); if (NULL != hProcess) { DWORD cbNeeded; HMODULE hMod; // process path if (EnumProcessModules(hProcess, &hMod, sizeof(hMod), &cbNeeded)) { DWORD dw = GetModuleFileNameExW(hProcess, hMod, name, 1024); } CloseHandle(hProcess); } return QString::fromWCharArray(name); #else return ""; #endif }