Windows apps
Collapse the table of content
Expand the table of content

Type Building Interfaces and Functions [Automation]

The type building interfaces are used to build tools that automate the process of generating type descriptions and creating type libraries. For example, the Microsoft Interface Definition Language (MIDL) compiler uses these interfaces to create type libraries. The following interfaces and functions are used to create an Automation type library:

  • ICreateTypeInfo - Provides the tools for creating and administering the type information defined through the type description.

  • ICreateTypeInfo2 - Adds methods for deleting items that have been added through ICreateTypeInfo.

  • ICreateTypeLib - Provides the methods for creating and managing the component or file that contains type information.

  • CreateTypeLib API - Provides access to a new object instance that supports the ICreateTypeLib interface.

  • ICreateTypeLib2 - Supports the creation and administration of type libraries and type descriptions.

  • CreateTypeLib2 API - Creates a type library in the current file format.

  • ITypeChangeEvents – Raises functions when change is requested on a type and after the change has been made.

Generally, it is not necessary to write custom implementations of these interfaces. The compilers use the default implementations that are returned by the CreateTypeLib function. To create tools similar to MkTypLib, the default implementations can be called.

Implemented by

Used by

Header file name

Import library name

Oleaut32.dll (32-bit systems)

Typelib.dll (16-bit systems)

Applications that expose programmable objects.





You create an Automation type library by using the ICreateTypeLib and ICreateTypeInfo interfaces.

In the following example, a type library is created (Hello.tlb) by the MIDL compiler, using the following .odl file.

uuid(2F6CA420-C641-101A-B826-00DD01103DE1),            // LIBID_Hello
helpstring("Hello 1.0 Type Library"),
library Hello
#ifdef WIN32

uuid(2F6CA422-C641-101A-B826-00DD01103DE1),        // IID_IHello
helpstring("Hello Interface")
interface IHello : IUnknown
[propput] void HelloMessage([in] BSTR Message);
[propget] BSTR HelloMessage(void);
void SayHello(void);
uuid(2F6CA423-C641-101A-B826-00DD01103DE1),        // IID_DHello
helpstring("Hello Dispinterface")
dispinterface DHello
interface IHello;

uuid(2F6CA421-C641-101A-B826-00DD01103DE1),       // CLSID_Hello.
helpstring("Hello Class")
coclass Hello
dispinterface DHello;
interface IHello;

For more information about type libraries, refer to Type Libraries and the Object Description Language.

© 2016 Microsoft