C++ (Qt)HANDLE proc = ::OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, theProcessID);if (!proc) return false; char buf[MAX_PATH];if (::GetProcessImageFileName(proc, buf, sizeof(buf) - 1)) {...}CloseHandle(proc);
C++ (Qt) DWORD pid = ...; HANDLE h = ::OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid); if(!h) return false; TCHAR tname[MAX_PATH]; if(!::GetProcessImageFileName(h, tname, sizeof(tname))) return false; QString name = QFileInfo(#ifdef UNICODE QString::fromWCharArray(tname)#else QString::fromUtf8(tname)#endif ).fileName(); ::CloseHandle(h);
DEFINES += _WIN32_WINNT=0x0501 WINVER=0x0501
LIBS += -lpsapi