RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.GetModuleFileName Function

Returns the fully qualified name for a module, given its handle.

Pascal
function GetModuleFileName(Module: HMODULE; Buffer: PChar; BufLen: Integer): Integer;
C++
int GetModuleFileName(HMODULE Module, const char * Buffer, int BufLen);

Call GetModuleFileName to obtain the fully qualified name of a module, given its handle. The version of GetModuleFileName defined in the System unit is available only on Linux. On Windows, use the Windows API with the same name instead. 

Module is the handle of the module whose file name is required. 

Buffer is a buffer that receives the file name. 

BufLen is the number of bytes in Buffer. 

GetModuleFileName returns the number of bytes written to Buffer.

Warning: GetModuleFileName is not always successful. Depending on the way the application is called, the presence of the /proc file system, and other factors, there are times when GetModuleFileName may return a name that is not fully qualified or in some cases, no file name at all. Be sure to check the results of this function before using the returned value.
 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!