次の方法で共有


ITypeLib::GetTypeInfo (Compact 2013)

3/26/2014

This method retrieves the specified type description in the library.

Syntax

HRESULT GetTypeInfo( 
  unsigned int index, 
  ITypeInfo FAR* FAR* ppTInfo 
); 

Parameters

  • index
    [in] Index of the ITypeInfo interface to be returned.
  • ppTInfo
    [out] If successful, returns a pointer to the pointer to the ITypeInfo interface.

Return Value

The following table shows the return values for this function.

Value

Description

S_OK

Success.

TYPE_E_ELEMENTNOTFOUND

The index parameter is outside the range of 0 to ITypeLib::GetTypeInfoCount -1.

E_OUTOFMEMORY

Out of memory.

E_INVALIDARG

One or more of the parameters is invalid.

TYPE_E_IOERROR

The function could not read from the file.

TYPE_E_INVDATAREAD

Invalid data.

TYPE_E_UNSUPFORMAT

The type library has an older format.

TYPE_E_REGISTRYACCESS

There was an error accessing the system registration database.

TYPE_E_INVALIDSTATE

The type library could not be opened.

Remarks

For dual interfaces, ITypeLib::GetTypeInfo returns only the TKIND_DISPATCH type information.

To get the TKIND_INTERFACE type information, ITypeInfo::GetRefTypeOfImplType can be called on the TKIND_DISPATCH type information, passing an index of -1. Then, the returned type information handle can be passed to ITypeInfo::GetRefTypeInfo.

Example

The following code example gets the TKIND_INTERFACE type information for a dual interface.

ptlib->GetTypeInfo((unsigned int) dwIndex, &ptypeinfoDisp);
ptypeinfoDisp->GetRefTypeOfImplType(-1, &phreftype);
ptypeinfoDisp->GetRefTypeInfo(phreftype, &ptypeinfoInt);

Requirements

Header

oaidl.h,
oaidl.idl

Library

oleaut32.lib,
uuid.lib

See Also

Reference

ITypeLib
ITypeInfo::GetRefTypeInfo
ITypeInfo::GetRefTypeOfImplType
ITypeLib::GetTypeInfoCount