Method AutomationObject():loadTypeLib() Foundation

Loads a typelibrary.

Syntax
:loadTypeLib( <cTypelib> ) --> self
Parameters
<cTypelib>
<cTypelib> is the path and file name of the type library to load.
Return

This method returns the object executing the method. If the type library could not be loaded, a runtime error occurs.

Description

:loadTypeLib() loads type library information at runtime. The information contained in a type library is required by the Xbase++ runtime system. A COM/ActiveX component without type library information cannot be used with Xbase++. A type library file usually has the suffix *.TLB.

Loading a type library is required for all COM/ActiveX components that do not come with built-in type library information. A typical usage pattern is to (A) create the COM/ActiveX component, (B) load the required type library, and (C) to query the desired interface.

// #define for easier access to COM interface GUID string 
#define NOTYPELIB_INTERFACE "{EED8A574-9435-4856-8FE4-8A5510544D11}" 

// Create the object and load its type library 
oCom := CreateObject( "CLSID.NoTypelib" ) 
oCom:loadTypeLib( "bin\typelib.tlb" ) 

// Request the required interface 
oICom := oCom:queryInterface( NOTYPELIB_INTERFACE ) 

// Use the COM/ActiveX object 

// Free resources 
oICom:destroy() 
oCom:destroy() 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.