次の方法で共有


ITypeInfo (Windows CE 5.0)

Send Feedback

This interface is 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.

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 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 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
  • 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 object's 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.

Methods

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

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 FUNCDESC structure 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 IMPLTYPEFLAGS for 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 TYPEATTR structure that contains the type description attributes.
ITypeInfo::GetTypeComp This method retrieves the ITypeComp interface for the type description, which enables a client compiler to bind to the type description's members.
ITypeInfo::GetVarDesc This method retrieves a VARDESC structure 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 FUNCDESC previously returned by GetFuncDesc.
ITypeInfo::ReleaseTypeAttr This method releases a TYPEATTR previously returned by GetTypeAttr.
ITypeInfo::ReleaseVarDesc This method releases a VARDESC previously returned by GetVarDesc.

Requirements

OS Versions: Windows CE 2.0 and later.
Header: Oaidl.h, Oaidl.idl.
Link Library: Oleaut32.lib, Uuid.lib.

See Also

Automation Interfaces | FUNCDESC | IDispatch | IDispatch::Invoke | IMPLTYPEFLAGS | IUnknown | VARDESC

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.