ITypeLib::GetTypeInfo

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

Retrieves the specified type description in the library.

Parameters

index
Index of the ITypeInfo interface to be returned.
ppTInfo
If successful, returns a pointer to the pointer to the ITypeInfo interface.

Return Value

The return value obtained from the returned HRESULT is one of the following:

Return value Meaning
S_OK Success.
TYPE_E_ELEMENTNOTFOUND The index parameter is outside the range of 0 to GetTypeInfoCount() –1.
E_OUTOFMEMORY Out of memory.
E_INVALIDARG One or more of the arguments 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.

Comments

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 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);