IDispatch::GetTypeInfo method

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

Syntax


HRESULT GetTypeInfo(
  [in]   UINT iTInfo,
  [in]   LCID lcid,
  [out]  ITypeInfo **ppTInfo
);

Parameters

iTInfo [in]

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

lcid [in]

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.

ppTInfo [out]

The requested type information object.

Return value

This method can return one of these values.

Return codeDescription
S_OK

Success.

DISP_E_BADINDEX

The iTInfo parameter was not 0.

 

Examples

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


// This function implements GetTypeInfo for the CLines collection.
STDMETHODIMP
CLines::GetTypeInfo(
      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;
}


Requirements

IDL

OaIdl.idl

See also

IDispatch

 

 

Community Additions

ADD
Show:
© 2014 Microsoft