ITypeLib::GetTypeInfo method (oaidl.h)

Retrieves the specified type description in the library.

Syntax

HRESULT GetTypeInfo(
  [in]  UINT      index,
  [out] ITypeInfo **ppTInfo
);

Parameters

[in] index

The index of the interface to be returned.

[out] ppTInfo

If successful, returns a pointer to the pointer to the ITypeInfo interface.

Return value

This method can return one of these values.

Return code Description
S_OK
Success.
TYPE_E_ELEMENTNOTFOUND
The index parameter is outside the range of to GetTypeInfoCount - 1.
E_INVALIDARG
One or more of the arguments is not valid.
E_OUTOFMEMORY
Insufficient memory to complete the operation.

Remarks

For dual interfaces, GetTypeInfo returns only the TKIND_DISPATCH type information. To get the TKIND_INTERFACE type information, 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 GetRefTypeInfo.

Examples

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

HRESULT hr;
hr = ptlib->GetTypeInfo((unsigned int) dwIndex, &ptypeinfoDisp);
if (FAILED(hr)) {
   //free resources
   return hr;
}
hr = ptypeinfoDisp->GetRefTypeOfImplType(-1, &phreftype);
if (FAILED(hr)) {
   //free resources
   return hr;

hr = ptypeinfoDisp->GetRefTypeInfo(phreftype, &ptypeinfoInt);
if (FAILED(hr)) {
   //free resources
   return hr;

// 

Requirements

Requirement Value
Target Platform Windows
Header oaidl.h

See also

ITypeLib