ITypeLib::GetTypeInfo method

Retrieves the specified type description in the library.

Syntax


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

Parameters

index [in]

The index of the interface to be returned.

ppTInfo [out]

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

Return value

This method can return one of these values.

Return codeDescription
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, GetTypeInforeturns 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

IDL

OaIdl.idl

See also

ITypeLib

 

 

Show: