Root > Reference > All Functions > GetModuleType

Function GetModuleType

Previous pageReturn to chapter overviewNext page   

Returns type of loaded executable module, based on analyzing its file header.







Code (Delphi)

function GetModuleType(

const AInstance: HMODULE = 0

): TModuleType;



AInstance [in, optional]

Module handle to analyze. Default (0) means current module.


Be careful with using 0 in packaged application. It's always better to explicitly specify required module.


Return value

Type of the AInstance module. It is TModuleType.mtProgram, TModuleType.mtLibrary or TModuleType.mtPackage on success and TModuleType.mtUnknown on error.





This is routine from low-level unit. Do not use this unit unless you need to extend or alter EurekaLog behavior.


This function analyzes PE header of loaded executable and return its type: EXE, DLL or BPL.


Function doesn't cache results and perform checking on each call.


There are also simple wrappers for more easy access. For example, IsEXE, IsDLL and so on. See EAppType unit for more info.


See also

Send feedback... Build date: 2022-03-28
Last edited: 2022-03-28
The documentation team uses the feedback submitted to improve the EurekaLog documentation. We do not use your e-mail address for any other purpose. We will remove your e-mail address from our system after the issue you are reporting has been resolved. While we are working to resolve this issue, we may send you an e-mail message to request more information about your feedback. After the issues have been addressed, we may send you an email message to let you know that your feedback has been addressed.

Permanent link to this article: