ITypeInfo : IUnknown

This interface is typically used for reading information about objects.

At a Glance

Header file: Oaidl.h
Windows CE versions: 2.0 and later

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

Implemented by Used by Header file name
Oleaut32.dll (32-bit systems)

Typelib.dll (16-bit systems)

Tools that need to access the descriptions of objects contained in type libraries. Oleauto.h

Dispatch.h


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 ITypeInfo interface provides access to the following:

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

An instance of ITypeInfo provides various information about the type of an object, and is used in different ways. A compiler can use an ITypeInfo to compile references to members of the type. A type interface browser can use it to find information about each member of the type. An IDispatch implementor can use it to provide automatic delegation of IDispatch calls to an interface.

Type Descriptions

The information associated with an object described by ITypeInfo can include a set of functions, a set of data members, and 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 ITypeInfo interface 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, ITypeInfo can 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.
IDispatch interface dispinterface IDispatch properties 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 IDispatch interfaces.

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 union description 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 module has TypeKind = TKIND_MODULE. A module is a set of static functions and a set of static data members.

OLE-Compatible Interface

An interface definition 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 IDispatch interface with a specification of the dispatch data members (such as properties) and methods supported through the objects Invoke implementation. 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 lcid and retval parameters, and the HRESULT return types are removed, and the return type of the member is specified to be the same type as the retval parameter.

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::GetRefTypeOfImplType with an index of –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.

Method Description
ITypeInfo::AddressOfMember Retrieves the addresses of static functions or variables, such as those defined in a dynamic-link library (DLL).
ITypeInfo::CreateInstance Creates a new instance of a type that describes a component object class (coclass).
ITypeInfo::GetContainingTypeLib Retrieves both the type library that contains a specific type description and the index of the type description within the type library.
ITypeInfo::GetDllEntry Retrieves a description or specification of an entry point for a function in a dynamic-link library (DLL).
ITypeInfo::GetDocumentation 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 Retrieves the FUNCDESC structure that contains information about a specified function.
ITypeInfo::GetIDsOfNames Maps between the names and identifiers of members and parameters.
ITypeInfo::GetImplTypeFlags Retrieves the IMPLTYPE flags for an interface.
ITypeInfo::GetMops Retrieves marshaling information.
ITypeInfo::GetNames 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 Retrieves the type descriptions referenced by a specified type description.
ITypeInfo::GetRefTypeOfImplType Retrieves the type description of implemented interface types for a component object class (coclass) or an inherited interface.
ITypeInfo::GetTypeAttr Retrieves a TYPEATTR structure that contains the type description attributes.
ITypeInfo::GetTypeComp Retrieves the ITypeComp interface for the type description, which enables a client compiler to bind to the type description’s members.
ITypeInfo::GetVarDesc Retrieves a VARDESC structure that describes the specified variable.
ITypeInfo::Invoke Invokes a method or accesses a property of an object that implements the interface indicated by the type description.
ITypeInfo::ReleaseFuncDesc Releases a FUNCDESC previously returned by GetFuncDesc.
ITypeInfo::ReleaseTypeAttr Releases a TYPEATTR previously returned by GetTypeAttr.
ITypeInfo::ReleaseVarDesc Releases a VARDESC previously returned by GetVarDesc.