HRESULT LoadTypeLib(
OLECHAR FAR* szFile,
ITypeLib FAR* FAR* pptlib
);
Loads and registers a type library.
The return value obtained from the returned HRESULT is one of the following:
Return value | Meaning |
---|---|
S_OK | Success. |
E_OUTOFMEMORY | Out of memory. |
E_INVALIDARG | One or more of the arguments is invalid. |
TYPE_E_IOERROR | The function could not write to the file. |
TYPE_E_INVALIDSTATE | The type library could not be opened. |
TYPE_E_INVDATAREAD | The function could not read from the file. |
TYPE_E_UNSUPFORMAT | The type library has an older format. |
TYPE_E_UNKNOWNLCID | The LCID could not be found in the OLE-supported DLLs. |
TYPE_E_CANTLOADLIBRARY | The type library or DLL could not be loaded. |
Other return codes | All FACILITY_STORAGE errors can be returned. |
The function LoadTypeLib loads a type library (usually created with MkTypLib) that is stored in the specified file. If szFile specifies only a file name without any path, LoadTypeLib searches for the file and proceeds as follows:
LoadTypeLib("C:\MONTANA\EXE\MFA.EXE\3", pptlib)
This statement loads the type library resource 3 from the file Mfa.exe file.
If the type library is already loaded, LoadTypeLib increments the type library's reference count and returns a pointer to the type library.
For backward compatibility, LoadTypeLib will register the type library if the path is not specified in the szFile parameter. LoadTypeLib will not register the type library if the path of the type library is specified. It is recommended that RegisterTypeLib be used to register a type library.
Windows NT: Use version 3.1 and later.
Windows: Use Windows 95 and later.
Header: Declared in oleauto.h.
Import Library: Link with oleaut32.lib.