LoadTypeLibWithResolver Function

Loads a type library and uses the supplied ITypeLibResolver interface to resolve any internally referenced type libraries.

HRESULT LoadTypeLibWithResolver(
    [in]  LPCOLESTR           szFile,
    [in]  REGKIND             regkind,
    [in]  ITypeLibResolver   *pTlbResolver,
    [out] ITypeLib          **pptlib);

szFile

[in] The file path of the type library.

regkind

[in] A REGKIND Enumeration enumeration flag that controls how the type library is registered. Its possible values are as follows:

  • REGKIND_DEFAULT: Use default registration behavior.

  • REGKIND_REGISTER: Register this type library.

  • REGKIND_NONE: Do not register this type library.

pTlbResolver

[in] A pointer to the implementation of the ITypeLibResolver interface.

pptlib

[out] A reference to the type library that is being loaded.

One of the HRESULT values listed in the following table.

Return value

Meaning

S_OK

Success.

E_OUTOFMEMORY

Out of memory.

E_POINTER

One or more of the pointers are invalid.

E_INVALIDARG

One or more of the arguments are invalid.

TYPE_E_IOERROR

The function could not write to the file.

TYPE_E_REGISTRYACCESS

The system registration database could not be opened.

TYPE_E_INVALIDSTATE

The type library could not be opened.

TYPE_E_CANTLOADLIBRARY

The type library or DLL could not be loaded.

The Tlbexp.exe (Type Library Exporter) calls the LoadTypeLibWithResolver function during the assembly-to-type-library conversion process.

This function loads the specified type library with minimal access to the registry. The function then examines the type library for internally referenced type libraries, each of which must be loaded and added to the parent type library.

Before a referenced type library can be loaded, its reference file path must be resolved to a full file path. This is accomplished through the ResolveTypeLib method that is provided by the ITypeLibResolver interface, which is passed in the pTlbResolver parameter.

When the full file path of the referenced type library is known, the LoadTypeLibWithResolver function loads and adds the referenced type library to the parent type library, creating a combined master type library.

After the function resolves and loads all internally referenced type libraries, it returns a reference to the master resolved type library in the pptlib parameter.

The LoadTypeLibWithResolver function is generally called by the Tlbexp.exe (Type Library Exporter), which supplies its own internal ITypeLibResolver interface implementation in the pTlbResolver parameter.

If you call LoadTypeLibWithResolver directly, you must supply your own ITypeLibResolver interface implementation.

Platforms: See .NET Framework System Requirements.

Header: TlbRef.h

Library: TlbRef.lib

.NET Framework Version: 3.5, 3.0, 2.0

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft