本文整理汇总了C++中ITypeInfo::AddRef方法的典型用法代码示例。如果您正苦于以下问题:C++ ITypeInfo::AddRef方法的具体用法?C++ ITypeInfo::AddRef怎么用?C++ ITypeInfo::AddRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITypeInfo
的用法示例。
在下文中一共展示了ITypeInfo::AddRef方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
STDMETHODIMP
InterfaceAdapter::GetTypeInfo (
InterfaceAdapter *pThis, UINT index, LCID, ITypeInfo **ppTypeInfo)
{
if (index != 0) {
*ppTypeInfo = 0;
return DISP_E_BADINDEX;
}
ITypeInfo *pTypeInfo = pThis->m_dispatchImpl.typeInfo();
pTypeInfo->AddRef();
*ppTypeInfo = pTypeInfo;
return S_OK;
}
示例2: ExpandTypeInfo
BOOL CTreeItem::ExpandTypeInfo( HTREEITEM hitem )
{
ASSERT(m_pTree) ;
ASSERT(hitem) ;
CTreeItem* pNewItem = NULL ;
HRESULT hr = S_OK ;
TV_INSERTSTRUCT tvis ;
CString strError = "Enumerating TypeInfo" ;
TYPEATTR* pattr = NULL ;
ITypeInfo* pti = GetTypeInfo() ;
ASSERT(pti) ;
BOOL fExpand = FALSE ;
tvis.hParent = hitem ;
tvis.hInsertAfter = TVI_LAST ;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN ;
tvis.item.iImage = typeUnknown ;
tvis.item.iSelectedImage = tvis.item.iImage + 1 ;
TRY
{
ENSURE(pti);
hr = pti->GetTypeAttr(&pattr) ;
if FAILED(hr)
{
strError.Format(_T("ITypeInfo::GetTypeAttr() failed"), hr ) ;
AfxThrowMemoryException() ;
}
switch(pattr->typekind)
{
// typedef [attributes] enum [tag] {
// enumlist
// } enumname;
//
// "typedef enum enumname"
case TKIND_ENUM:
fExpand = ExpandVars( hitem ) ;
break ;
// typedef [attributes]
// struct [tag] {
// memberlist
// } structname;
//
// "typedef struct structname"
case TKIND_RECORD:
fExpand = ExpandVars( hitem ) ;
break ;
// [attributes]
// module modulename {
// elementlist
// };
case TKIND_MODULE:
if (pattr->cVars)
{
// Add "Constants" folder
//
#pragma warning (suppress: 6211)
#pragma warning (suppress: 6014)
pNewItem = new CTreeItem(m_pTree) ;
pNewItem->m_Type = typeProperties ;
pNewItem->SetTypeInfo(pti) ;
pti->AddRef() ;
tvis.item.cChildren = pattr->cVars ;
tvis.item.lParam = (LPARAM)pNewItem ;
tvis.item.pszText = _T("Constants") ;
tvis.item.iImage = typeConstants ;
tvis.item.iSelectedImage = tvis.item.iImage + 1 ;
m_pTree->InsertItem( &tvis ) ;
fExpand = TRUE ;
}
if (pattr->cFuncs)
{
pNewItem = new CTreeItem(m_pTree) ;
pNewItem->m_Type = typeMethods ;
pNewItem->SetTypeInfo(pti) ;
pti->AddRef() ;
tvis.item.cChildren = pattr->cFuncs ;
tvis.item.lParam = (LPARAM)pNewItem ;
tvis.item.pszText = _T("Functions") ;
tvis.item.iImage = typeMethods ;
tvis.item.iSelectedImage = tvis.item.iImage + 1 ;
m_pTree->InsertItem( &tvis ) ;
fExpand = TRUE ;
}
break ;
// [attributes]
// interface interfacename [:baseinterface] {
// functionlist
// };
case TKIND_INTERFACE:
fExpand = ExpandFuncs( hitem) ;
if (pattr->cImplTypes)
{
pNewItem = new CTreeItem(m_pTree) ;
pNewItem->m_Type = typeImplTypes ;
//.........这里部分代码省略.........