Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This interface is typically used for reading information about objects. For example, an object browser tool can use ITypeInfoto extract information about the characteristics and capabilities of objects from type libraries.

Type information interfaces are intended to describe the parts of the application that can be called by outside clients, rather than those that might be used internally to build an application.

The ITypeInfointerface provides access to the following:

  • The set of function descriptions associated with the type. For interfaces, this contains the set of member functions in the interface.

  • The set of data member descriptions associated with the type. For structures, this contains the set of members of the type.

  • The general attributes of the type, such as whether it describes a structure, an interface, and so on.

The type description of an IDispatchinterface can be used to implement the interface.

An instance of ITypeInfoprovides various information about the type of an object, and is used in different ways. A compiler can use an ITypeInfoto compile references to members of the type. A type interface browser can use it to find information about each member of the type. An IDispatchimplementor can use it to provide automatic delegation of IDispatchcalls to an interface.

Type Descriptions

The information associated with an object described by ITypeInfocan include

  • A set of functions

  • A set of data members

  • Various type attributes

It is essentially the same as the information described by a C++ class declaration, which can be used to define both interfaces and structures, as well as any combination of functions and data members.

In addition to interfaces and structure definitions, the ITypeInfointerface is used to describe other types, including enumerations and aliases. Because the interface to a C file or library is simply a set of functions and variable declarations, ITypeInfocan also be used to describe them.

Type information comprises individual type descriptions. Each type description must have one of the following forms.

Category ODL keyword Description

alias

typedef

An alias for another type.

enumeration

enum

An enumeration.

structure

struct

A structure.

union

union

A single data item that can have one of a specified group of types.

module

module

Data and functions not accessed through virtual function table (VTBL) entries.

IDispatchinterface

dispinterface

IDispatchproperties and methods accessed through IDispatch::Invoke.

OLE interface

interface

OLE member functions accessed through VTBL entries.

dual interface

dual

Supports either VTBL or IDispatch.

component object class

coclass

A component object class. Specifies an implementation of one or more OLE interfaces and one or more IDispatchinterfaces.

Note:
All bit flags that are not used specifically should be set to zero for future compatibility.

Alias

An alias has TypeKind = TKIND_ALIAS. An alias is an empty set of functions, an empty set of data members, and a type description (located in the TYPEATTR), which gives the actual type definition ( typedef) of the alias.

Enumeration (Statement)

An enumeration ( enum) has TypeKind = TKIND_ENUM. An enumeration is an empty set of functions and a set of constant data members.

Structure (Statement)

A structure ( struct) description has TypeKind = TKIND_RECORD. A structure is an empty set of functions and a set of per-instance data members.

Union (Statement)

A uniondescription has TypeKind = TKIND_UNION. A union is an empty set of functions and a set of per-instance data members, each of which has an instance offset of zero.

Module (Statement)

A modulehas TypeKind = TKIND_MODULE. A module is a set of static functions and a set of static data members.

OLE-Compatible Interface

An interfacedefinition has TypeKind = TKIND_INTERFACE. An interface is a set of pure virtual functions and an empty set of data members. If a type description contains any virtual functions, then the pointer to the VTBL is the first 4 bytes of the instance.

The type information fully describes the member functions in the VTBL, including parameter names and types and function return types. It may inherit from no more than one other interface.

With interfaces and dispinterfaces, all members should have different names, except the accessor functions of properties. For property functions having the same name, the documentation string and Help context should be set for only one of the functions (because they define the same property conceptually).

IDispatch Interface

These include objects (TypeKind = TKIND_DISPATCH) that support the IDispatchinterface with a specification of the dispatch data members (such as properties) and methods supported through the object's Invokeimplementation. All members of the dispinterface should have different IDs, except for the accessor functions of properties.

Dual Interface

Dual interfaces have two different type descriptions for the same interface.

  • The TKIND_INTERFACE type description describes the interface as a standard OLE Component Object Model (COM) interface.

  • The TKIND_DISPATCH type description describes the interface as a standard dispatch interface.

The lcidand retvalparameters, and the HRESULT return types are removed, and the return type of the member is specified to be the same type as the retvalparameter.

By default, the TYPEKIND enumeration for a dual interface is TKIND_INTERFACE. Tools that bind to interfaces should check the type flags for TYPEFLAG_FDUAL.

If this flag is set, the TKIND_DISPATCH type description is available through a call to ITypeInfo::GetRefTypeOfImplTypewith an indexof –1, followed by a call to ITypeInfo::GetRefTypeInfo.

Component Object Classes

These coclass objects (TypeKind = TKIND_COCLASS) support a set of implemented interfaces, which can be of either TKIND_INTERFACE or TKIND_DISPATCH.

Methods

The following table shows the methods for this interface in alphabetical order. Like all COM interfaces, this interface inherits the methods for the IUnknowninterface.

Method Description

ITypeInfo::AddressOfMember

This method retrieves the addresses of static functions or variables, such as those defined in a dynamic-link library (DLL).

ITypeInfo::CreateInstance

This method creates a new instance of a type that describes a component object class (coclass).

ITypeInfo::GetContainingTypeLib

This method retrieves both the type library that contains a specific type description and the index of the type description within the type library.

ITypeInfo::GetDllEntry

This method retrieves a description or specification of an entry point for a function in a dynamic-link library (DLL).

ITypeInfo::GetDocumentation

This method retrieves the documentation string, name of the complete Help file name and path, and the context identifier for the Help topic for a specified type description.

ITypeInfo::GetFuncDesc

This method retrieves the FUNCDESCstructure that contains information about a specified function.

ITypeInfo::GetIDsOfNames

This method maps between the names and identifiers of members and parameters.

ITypeInfo::GetImplTypeFlags

This method retrieves the IMPLTYPEFLAGSfor an interface.

ITypeInfo::GetMops

This method retrieves marshaling information.

ITypeInfo::GetNames

This method retrieves the variable with the specified member identifier, or the name of the function and parameter names corresponding to the specified function identifier.

ITypeInfo::GetRefTypeInfo

This method retrieves the type descriptions referenced by a specified type description.

ITypeInfo::GetRefTypeOfImplType

This method retrieves the type description of implemented interface types for a component object class (coclass) or an inherited interface.

ITypeInfo::GetTypeAttr

This method retrieves a TYPEATTRstructure that contains the type description attributes.

ITypeInfo::GetTypeComp

This method retrieves the ITypeCompinterface for the type description, which enables a client compiler to bind to the type description's members.

ITypeInfo::GetVarDesc

This method retrieves a VARDESCstructure that describes the specified variable.

ITypeInfo::Invoke

This method invokes a method or accesses a property of an object that implements the interface indicated by the type description.

ITypeInfo::ReleaseFuncDesc

This method releases a FUNCDESCpreviously returned by GetFuncDesc.

ITypeInfo::ReleaseTypeAttr

This method releases a TYPEATTRpreviously returned by GetTypeAttr.

ITypeInfo::ReleaseVarDesc

This method releases a VARDESCpreviously returned by GetVarDesc.

Requirements

Header oaidl.h, oaidl.idl
Library oleaut32.lib, uuid.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also