The GetModuleFileName function retrieves the fully qualified path for the specified module.
To specify the process that contains the module, use the GetModuleFileNameEx function.
Pointer to a buffer that receives a null-terminated string that specifies the fully-qualified path of the module. If the length of the path exceeds the size specified by the size parameter, the function succeeds and the string is truncated to size characters and null terminated.
The path can have the prefix "\\?\", depending on how the module was loaded.
If the function succeeds, the return value is the length of the string copied to the buffer, in TCHARs. If the buffer is too small to hold the module name, the string is truncated to size, and the function returns size.
If the function fails, the return value is zero. To get extended error information, call GetLastWin32Error.
If a DLL is loaded in two processes, its file name in one process may differ in case from its file name in the other process.
For the ANSI version of the function, the number of TCHARs is the number of bytes; for the Unicode version, it is the number of characters.
Windows Me/98/95: This function retrieves long file names when an application's version number is greater than or equal to 4.00 and the long file name is available. Otherwise, it returns only 8.3 format file names.
Kernel Class | Tao.Platform.Windows Namespace | GetModuleHandle | LoadLibrary