DWORD GetModuleFileNameEx( HANDLE hProcess, // handle to process HMODULE hModule, // handle to module LPTSTR lpFilename, // path buffer DWORD nSize // maximum characters to retrieve ); Parameters hProcess [in] Handle to the process that contains the module. hModule [in] Handle to the module. lpFilename [out] Pointer to the buffer that receives the fully qualified path to the module. If the file name is longer than maximum number of characters specified by the nSize parameter, the file name is truncated. nSize [in] Specifies the maximum number of characters to copy to the lpFilename buffer.
再以Process32First、Process32Next枚举当前的进程,可以得到进程的执行文件名,但得不到路径
DWORD GetModuleFileName(
HMODULE hModule, // handle to module
LPTSTR lpFilename, // path buffer
DWORD nSize // size of buffer
);
HANDLE hProcess, // handle to process
HMODULE hModule, // handle to module
LPTSTR lpFilename, // path buffer
DWORD nSize // maximum characters to retrieve
);
Parameters
hProcess
[in] Handle to the process that contains the module.
hModule
[in] Handle to the module.
lpFilename
[out] Pointer to the buffer that receives the fully qualified path to the module. If the file name is longer than maximum number of characters specified by the nSize parameter, the file name is truncated.
nSize
[in] Specifies the maximum number of characters to copy to the lpFilename buffer.