本文整理汇总了C++中LPUNKNOWN::AddRef方法的典型用法代码示例。如果您正苦于以下问题:C++ LPUNKNOWN::AddRef方法的具体用法?C++ LPUNKNOWN::AddRef怎么用?C++ LPUNKNOWN::AddRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPUNKNOWN
的用法示例。
在下文中一共展示了LPUNKNOWN::AddRef方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetInterface
STDAPI GetInterface(LPUNKNOWN pUnk, void **ppv)
{
CheckPointer(ppv, E_POINTER);
*ppv = pUnk;
pUnk->AddRef();
return NOERROR;
}
示例2: GetInterface
LPUNKNOWN CComObject::GetInterface(REFIID pIID, BOOL bAddRef)
{
LPUNKNOWN pInterface = CCmdTarget::GetInterface( &pIID );
if ( ! pInterface && pIID == IID_IDispatch )
{
if ( POSITION pos = m_pDispatchMap.GetStartPosition() )
{
const IID* pDispIID;
m_pDispatchMap.GetNextAssoc( pos, pInterface, pDispIID );
}
}
if ( pInterface && bAddRef ) pInterface->AddRef();
return pInterface;
}
示例3: if
STDMETHODIMP
CShellExtension::QueryInterface(REFIID riid, LPVOID *ppObj)
{
*ppObj = 0;
if (IsEqualIID(riid, IID_IUnknown))
*ppObj = this;
else if (IsEqualIID(riid, IID_IShellExtInit))
*ppObj = (IShellExtInit *)this;
else if (IsEqualIID(riid, IID_IContextMenu))
*ppObj = (IContextMenu *)this;
if (*ppObj) {
LPUNKNOWN pUnk = (LPUNKNOWN)(*ppObj);
pUnk->AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
示例4: intrusive_ptr_add_ref
void intrusive_ptr_add_ref(LPUNKNOWN com) {
assert(com);
com->AddRef();
}