How can I get the file name of process from a process handle? I'm using Win32 C++ (Visual C++ Express Edition).
Thanks.
How can I get the file name of process from a process handle? I'm using Win32 C++ (Visual C++ Express Edition).
Thanks.
The GetProcessImageFileName
function retrieves the name of the executable file for the specified process handle (WinXP, Server 2k3 or later), as does QueryFullProcessImageName
for Vista and 2k8 or later.
Call GetModuleFileNameEx
. Available as of Windows 2000.
DWORD WINAPI GetModuleFileNameEx(
__in HANDLE hProcess,
__in_opt HMODULE hModule,
__out LPTSTR lpFilename,
__in DWORD nSize
);
Use NULL
for the second parameter to get the name of the EXE file.