Overview of Type Building Interfaces

The type building interfaces include the following member functions:

Interface Member function Purpose
ICreateTypeInfo AddFuncDesc Adds a function description as a type description.
AddImplType Specifies an inherited interface.
AddRefTypeInfo Adds a type description to those referenced by the type description being created.
AddVarDesc Adds a data member description as a type description.
DefineFuncAsDllEntry Associates a dynamic link library (DLL) entry point with a function that has a specified index.
LayOut Assigns virtual function table (VTBL) offsets for virtual functions and instance offsets for per-instance data members.
SetAlignment Specifies data alignment for types of TKIND_RECORD.
SetDocString Sets the documentation string displayed by type browsers.
SetFuncAndParamNames Sets the function name and names of its parameters.
SetFuncDocString Sets the documentation string for a function.
SetFuncHelpContext Sets the Help context identifier (ID) for a function.
SetGuid Sets the globally unique identifier (GUID) for the type library.
SetHelpContext Sets the Help context ID of the type description.
SetImplTypeFlags Sets the attributes for an implemented or inherited interface of a type.
SetMops Sets the opcode string for a type description.
SetTypeDescAlias Sets the type description for which this type description is an alias, if TYPEKIND=TKIND_ALIAS.
SetTypeFlags Sets type flags of the type description that is being created.
SetVarDocString Sets the documentation string for a variable.
SetVarHelpContext Sets the Help context ID for a variable.
SetVarName Sets the name of a variable.
SetVersion Sets version numbers for the type description.
ICreateTypeInfo2 DeleteFuncDesc Deletes a function description specified by the index number.
SetName Sets the name of the typeinfo.
DeleteFuncDescByMemId Deletes the function description specified by memid.
DeleteVarDesc Deletes the specified VARDESC structure.
DeleteVarDescByMemId Deletes the specified VARDESC structure.
DeleteImplType Deletes the IMPLTYPE flags for the indexed interface.
SetCustData Sets a value for custom data.
SetHelpStringContext Sets the context number for the specified Help string.
SetFuncCustData Sets a value for a specified custom function.
SetFuncHelpStringContext Sets a Help context value for a specified custom function.
SetVarCustData Sets a custom data variable.
SetParamCustData Sets the specified parameter for the custom data.
SetImplTypeCustData Sets the implementation type for custom data.
SetVarHelpStringContext Sets a Help context value for a specified variable.
ICreateTypeLib CreateTypeInfo Creates a new type description instance within the type library.
SaveAllChanges Saves the ICreateTypeLib instance.
SetDocString Sets the documentation string for the type library.
SetGuid Sets the GUID for the type library.
SetHelpContext Sets the Help context ID for general information about the type library in the Help file.
SetHelpFileName Sets the Help file name.
SetLcid Sets the locale identifier (LCID) code indicating the national language associated with the library.
SetLibFlags Sets library flags, such as LIBFLAG_FRESTRICTED.
SetName Sets the name of the type library.
SetVersion Sets major and minor version numbers for the type library.
ICreateTypeLib2 DeleteTypeInfo Deletes a specified type information from the type library.
SetName Sets the name of the type library.
SetCustData Sets a value to custom data.
SetHelpStringContext Sets the Help string context number.
SetHelpStringDll Sets the DLL name to be used for Help string lookup.

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 (or MkTypLib.exe), using the following .odl file.

[
uuid(2F6CA420-C641-101A-B826-00DD01103DE1),            // LIBID_Hello
helpstring("Hello 1.0 Type Library"),
lcid(0x0409),
version(1.0)
] 
library Hello
{
#ifdef WIN32
importlib("stdole32.tlb");
#else
importlib("stdole.tlb");
#endif

[
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;
}
}