How can I get the file name of process from a process handle? I'm using Win32 C++ (Visual C++ Express Edition).
Thanks.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With