GetModuleFileName

Syntax

int GetModuleFileName(hModule,lpFilename,nSize)

This function retrieves the full pathname of the executable file from which the specified module was loaded. The function copies the null-terminated filename into the buffer pointed to by the lpFilename parameter.

Parameter Type/Description  

hModule HANDLE Identifies the module or the instance of the module.  
lpFilename LPSTR Points to the buffer that is to receive the filename.  
nSize int Specifies the maximum number of characters to copy. If the filename is longer than the maximum number of characters specified by the nSize parameter, it is truncated.  

Return Value

The return value specifies the actual length of the string copied to the buffer.