Call GetModuleFileNameEx . Available since 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.
Rob kennedy
source share