HRESULT GetTypeInfo(
unsigned int iTInfo,
LCID lcid,
ITypeInfo FAR* FAR* ppTInfo
);
Retrieves the type information for an object, which can then be used to get the type information for an interface.
The return value obtained from the returned HRESULT is one of the following:
Return value | Meaning |
---|---|
S_OK | Success; the type information element exists. |
DISP_E_BADINDEX | Failure; iTInfo argument was not 0. |
TYPE_E_ELEMENTNOTFOUND | Failure; iTInfo argument was not 0. |
The following code from the sample file Lines.cpp loads information from the type library and implements the member function GetTypeInfo:
// These lines are from CLines::Create load type information for the
// Lines collection from the type library.
hr = LoadTypeInfo(&pLines->m_ptinfo, IID_ILines);
if (FAILED(hr))
goto error;
// Additional code omitted for brevity.
// This function implements GetTypeInfo for the CLines collection.
STDMETHODIMP
CLines::GetTypeInfo(
UINT iTInfo,
LCID lcid,
ITypeInfo FAR* FAR* ppTInfo)
{
*ppTInfo = NULL;
if(iTInfo != 0)
return ResultFromScode(DISP_E_BADINDEX);
m_ptinfo->AddRef();
*ppTInfo = m_ptinfo;
return NOERROR;
}
CreateStdDispatch, CreateDispTypeInfo.