MSDN Library

IDispatch::GetTypeInfo Method

Retrieves the type information for an object, which can then be used to get the type information for an interface.

HRESULT GetTypeInfo(  
  unsigned int  iTInfo,         
  LCID  lcid,                   
  ITypeInfo FAR* FAR*  ppTInfo  


The type information to return. Pass 0 to retrieve type information for the IDispatch implementation.


The locale identifier for the type information. An object may be able to return different type information for different languages. This is important for classes that support localized member names. For classes that do not support localized member names, this parameter can be ignored.


Receives a pointer to the requested type information object.

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

Return value



Success; the type information element exists.


Failure; iTInfo argument was not 0.

The following code from the sample file Lines.cpp implements the member function GetTypeInfo:

// This function implements GetTypeInfo for the CLines collection.
      UINT iTInfo,
      LCID lcid,
      ITypeInfo FAR* FAR* ppTInfo)
   if (ppTInfo == NULL)
      return E_INVALIDARG;
   *ppTInfo = NULL;

   if(iTInfo != 0)
      return DISP_E_BADINDEX;

   m_ptinfo->AddRef();      // AddRef and return pointer to cached
                           // typeinfo for this object.
   *ppTInfo = m_ptinfo;

   return NOERROR;
© 2016 Microsoft