本文整理汇总了C++中CComObject::AddRef方法的典型用法代码示例。如果您正苦于以下问题:C++ CComObject::AddRef方法的具体用法?C++ CComObject::AddRef怎么用?C++ CComObject::AddRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComObject
的用法示例。
在下文中一共展示了CComObject::AddRef方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
void PropertyAdmin::initialize()
{
if (m_bInitialized)
return;
m_bInitialized = true;
try
{
CComPtr<IPropertyManager> pPropMan;
if ((pPropMan.p = GET_OPMPROPERTY_MANAGER(m_pClass))==NULL)
_com_issue_error(E_FAIL);
_com_util::CheckError(CComObject<CSimpleProperty>::CreateInstance(&m_pSimple));
m_pSimple->AddRef();
_com_util::CheckError(CComObject<CCategorizedProperty>::CreateInstance(&m_pCategorized));
m_pCategorized->AddRef();
_com_util::CheckError(CComObject<CEnumProperty>::CreateInstance(&m_pEnum));
m_pEnum->AddRef();
_com_util::CheckError(pPropMan->AddProperty(m_pSimple));
_com_util::CheckError(pPropMan->AddProperty(m_pCategorized));
_com_util::CheckError(pPropMan->AddProperty(m_pEnum));
}
catch(const _com_error& )
{
uninitialize();
acutPrintf("\nSimpleDynProps: initialize failed!!!\n");
return;
}
}
示例2: InitVideoStream
HRESULT CTedTestSink::InitVideoStream()
{
HRESULT hr = S_OK;
InternalAddRef();
/*IMFMediaSink* pMediaSink;
InternalQueryInterface(this, CTedTestSink::_GetEntries(), IID_IMFMediaSink, (void**) &pMediaSink);*/
CComPtr<IMFMediaType> spVideoType;
IFC( MFCreateMediaType(&spVideoType) );
IFC( spVideoType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video) );
IFC( spVideoType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_RGB24) );
CComObject<CTedTestMediaTypeHandler>* pVideoTypeHandler = NULL;
IFC( CComObject<CTedTestMediaTypeHandler>::CreateInstance(&pVideoTypeHandler) );
pVideoTypeHandler->AddRef();
pVideoTypeHandler->SetMajorType(MFMediaType_Video);
pVideoTypeHandler->AddAvailableType(spVideoType);
CComObject<CTedTestStreamSink>* pVideoStreamSink = NULL;
IFC( CComObject<CTedTestStreamSink>::CreateInstance(&pVideoStreamSink) );
pVideoStreamSink->AddRef();
m_spVideoStreamSink = pVideoStreamSink;
//IFC( pVideoStreamSink->Init(pMediaSink, pVideoTypeHandler, 1) );
IFC( pVideoStreamSink->Init(this, pVideoTypeHandler, 1) );
pVideoTypeHandler->Release();
pVideoStreamSink->Release();
//pMediaSink->Release();
Cleanup:
return hr;
}
示例3: OnEditFrame
LRESULT CMediaClipView::OnEditFrame(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
#if 0
CComObject<CImageDocument>* pImageDocument;
CComObject<CImageDocument>::CreateInstance(&pImageDocument);
pImageDocument->AddRef();
{
CComObject<CImageLayerBitmap>* pLayer;
CComObject<CImageLayerBitmap>::CreateInstance(&pLayer);
pLayer->AddRef();
pLayer->m_pBitmap = m_pDocument->m_pSample->m_pBitmap;
pLayer->m_pInitialBitmap = pLayer->m_pBitmap->Clone(Gdiplus::Rect(0, 0, pLayer->m_pBitmap->GetWidth(), pLayer->m_pBitmap->GetHeight()), PixelFormat32bppARGB);
{
Gdiplus::BitmapData bitmapData;
pLayer->m_pBitmap->LockBits(
&Gdiplus::Rect(0, 0, pLayer->m_pBitmap->GetWidth(), pLayer->m_pBitmap->GetHeight()),
Gdiplus::ImageLockModeRead,
PixelFormat32bppARGB, &bitmapData);
GetAlphaBounds(&bitmapData, &pLayer->m_alphaBounds);
pLayer->m_pBitmap->UnlockBits(&bitmapData);
}
pLayer->m_name = L"Layer 0";
pLayer->m_width = pLayer->m_pBitmap->GetWidth();
pLayer->m_height = pLayer->m_pBitmap->GetHeight();
pImageDocument->m_width = pLayer->m_pBitmap->GetWidth();
pImageDocument->m_height = pLayer->m_pBitmap->GetHeight();
/*
Gdiplus::BitmapData data;
if (pBitmap->LockBits(
&Gdiplus::Rect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight()),
Gdiplus::ImageLockModeRead,
PixelFormat32bppPARGB, &data) != 0)
{
ATLASSERT(0);
return -1;
}
pBitmap->UnlockBits(&data);
*/
pLayer->m_parentGroup = pImageDocument->m_imageLayerGroup;
pImageDocument->m_imageLayerGroup->m_subLayers.Add(pLayer);
}
pImageDocument->ShowViews(NULL);
#endif
return 0;
}
示例4: CreateGlobalDefinition
IASDeclaration* CASXMLSchemaModel::CreateGlobalDefinition(ILDOMElement* element)
{
IASDeclaration* pDef = NULL;
BSTR btagName;
element->get_tagName(&btagName);
_bstr_t tagName = _bstr_t(btagName, false);
if (!wcscmp(tagName, L"element"))
{
CComObject<CGlobalElementDefinition>* p;
CComObject<CGlobalElementDefinition>::CreateInstance(&p);
p->AddRef();
p->m_element = element;
p->m_pSchema = this;
pDef = p;
}
else if (!wcscmp(tagName, L"attribute"))
{
pDef = NULL;//new CElementDefinition;
}
else if (!wcscmp(tagName, L"simpleType"))
{
CComObject<CSimpleTypeDefinition>* p;
CComObject<CSimpleTypeDefinition>::CreateInstance(&p);
p->AddRef();
p->m_element = element;
p->m_pSchema = this;
pDef = p;
}
else if (!wcscmp(tagName, L"complexType"))
{
CComObject<CComplexTypeDefinition>* p;
CComObject<CComplexTypeDefinition>::CreateInstance(&p);
p->AddRef();
p->m_element = element;
p->m_pSchema = this;
pDef = p;
}
if (pDef)
{
}
return pDef;
}
示例5: get_Item
STDMETHODIMP InterfaceAliases::get_Item(long Index, IInterfaceAlias **pVal)
{
try
{
if (!m_pAliases)
return GetAccessDenied();
CComObject<InterfaceAlias>* pAlias = new CComObject<InterfaceAlias>();
pAlias->SetAuthentication(m_pAuthentication);
shared_ptr<HM::Alias> pPersAlias = m_pAliases->GetItem(Index);
if (!pPersAlias)
return DISP_E_BADINDEX;
pAlias->AttachItem(pPersAlias);
pAlias->AddRef();
*pVal = pAlias;
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例6: GetAccessDenied
STDMETHODIMP
InterfaceBlockedAttachments::Add(IInterfaceBlockedAttachment **pVal)
{
try
{
if (!m_pBlockedAttachments)
return GetAccessDenied();
if (!m_pBlockedAttachments)
return m_pAuthentication->GetAccessDenied();
CComObject<InterfaceBlockedAttachment>* pInterfaceBlockedAttachment = new CComObject<InterfaceBlockedAttachment>();
pInterfaceBlockedAttachment->SetAuthentication(m_pAuthentication);
shared_ptr<HM::BlockedAttachment> pBA = shared_ptr<HM::BlockedAttachment>(new HM::BlockedAttachment);
pInterfaceBlockedAttachment->AttachItem(pBA);
pInterfaceBlockedAttachment->AttachParent(m_pBlockedAttachments, false);
pInterfaceBlockedAttachment->AddRef();
*pVal = pInterfaceBlockedAttachment;
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例7: GetAccessDenied
STDMETHODIMP
InterfaceBackupManager::LoadBackup(BSTR sXMLFile, IInterfaceBackup **pVal)
{
try
{
if (!m_pBackupManager)
return GetAccessDenied();
CComObject<InterfaceBackup>* pBackupInt = new CComObject<InterfaceBackup>();
pBackupInt->SetAuthentication(m_pAuthentication);
shared_ptr<HM::Backup> pBackup = m_pBackupManager->LoadBackup(sXMLFile);
if (!pBackup)
return DISP_E_BADINDEX;
pBackupInt->Attach(pBackup);
pBackupInt->AddRef();
*pVal = pBackupInt;
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例8: GetAccessDenied
STDMETHODIMP
InterfaceIMAPFolderPermission::get_Account(IInterfaceAccount **pVal)
{
try
{
if (!object_)
return GetAccessDenied();
CComObject<InterfaceAccount>* pInterfaceAccount = new CComObject<InterfaceAccount>();
pInterfaceAccount->SetAuthentication(authentication_);
std::shared_ptr<HM::Account> pAccount = std::shared_ptr<HM::Account>(new HM::Account);
if (!HM::PersistentAccount::ReadObject(pAccount, (__int64) object_->GetPermissionAccountID()))
return DISP_E_BADINDEX;
pInterfaceAccount->AttachItem(pAccount);
pInterfaceAccount->AddRef();
*pVal = pInterfaceAccount;
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例9: get_Group
STDMETHODIMP CCOMClauseVariant::get_Group(long lGroupNum, IGroup **pVal)
{
try
{
if( (lGroupNum < 0)
|| (lGroupNum >= m_pSynVariant->m_vectorGroups.GetGroups().size())
)
return E_FAIL;
const CGroup& group = m_pSynVariant->m_vectorGroups.GetGroups()[lGroupNum];
CComObject<CCOMGroup>* pGroup = NULL;
pGroup = new CComObject<CCOMGroup>;
BOOL bRes = pGroup->Init(&group, GetOptions());
if( !bRes )
return FALSE;
*pVal = pGroup;
pGroup->AddRef();
}
catch(...)
{
return E_FAIL;
}
return S_OK;
}
示例10: GetAccessDenied
STDMETHODIMP
InterfaceSSLCertificates::get_Item(long Index, IInterfaceSSLCertificate **pVal)
{
try
{
if (!m_pSSLCertificates)
return GetAccessDenied();
CComObject<InterfaceSSLCertificate>* pInterfaceSSLCertificate = new CComObject<InterfaceSSLCertificate>();
pInterfaceSSLCertificate->SetAuthentication(m_pAuthentication);
shared_ptr<HM::SSLCertificate> pBA = m_pSSLCertificates->GetItem(Index);
if (!pBA)
return DISP_E_BADINDEX;
pInterfaceSSLCertificate->AttachItem(pBA);
pInterfaceSSLCertificate->AttachParent(m_pSSLCertificates, true);
pInterfaceSSLCertificate->AddRef();
*pVal = pInterfaceSSLCertificate;
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例11: get_ItemByAddress
STDMETHODIMP InterfaceDistributionLists::get_ItemByAddress(BSTR sAddress, IInterfaceDistributionList **pVal)
{
try
{
if (!m_pDistributionLists)
return GetAccessDenied();
CComObject<InterfaceDistributionList>* pList = new CComObject<InterfaceDistributionList>();
pList->SetAuthentication(m_pAuthentication);
shared_ptr<HM::DistributionList> pPersList = m_pDistributionLists->GetItemByAddress(sAddress);
if (!pPersList)
return DISP_E_BADINDEX;
pList->AttachItem(pPersList);
pList->AttachParent(m_pDistributionLists, true);
pList->AddRef();
*pVal = pList;
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例12: GetAccessDenied
STDMETHODIMP
InterfaceSURBLServers::get_Item(long Index, IInterfaceSURBLServer **pVal)
{
try
{
if (!m_pSURBLServers)
return GetAccessDenied();
CComObject<InterfaceSURBLServer>* pInterfaceSURBLServer = new CComObject<InterfaceSURBLServer>();
pInterfaceSURBLServer->SetAuthentication(m_pAuthentication);
shared_ptr<HM::SURBLServer> pDNSBlackList = m_pSURBLServers->GetItem(Index);
if (!pDNSBlackList)
return DISP_E_BADINDEX;
pInterfaceSURBLServer->AttachItem(pDNSBlackList);
pInterfaceSURBLServer->AttachParent(m_pSURBLServers, true);
pInterfaceSURBLServer->AddRef();
*pVal = pInterfaceSURBLServer;
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例13: Add
STDMETHODIMP CMmRvFutColl::Add(LONG Key, BSTR SortKey, IMmRvFutAtom* Value, IMmRvFutAtom** pRetVal)
{
try
{
if(m_collRef.find(Key) != m_collRef.end())
EgLib::CComErrorWrapper::ThrowError(E_INVALIDARG, _T("Futures with the same key is already exists."));
if(!Value)
{
CComObject<CMmRvFutAtom>* pNewVal;
_CHK(CComObject<CMmRvFutAtom>::CreateInstance(&pNewVal), _T("Fail to add futures."));
pNewVal->AddRef();
if(FAILED(IMmRvFutCollImpl::Add(Key, CComBSTR(SortKey), pNewVal)))
{
pNewVal->Release();
EgLib::CComErrorWrapper::ThrowError(E_INVALIDARG, _T("Fail to add futures."));
}
*pRetVal = pNewVal;
}
else
{
_CHK(IMmRvFutCollImpl::Add(Key, CComBSTR(SortKey), Value), _T("Fail to add futures."));
Value->AddRef();
*pRetVal = Value;
}
}
catch(const _com_error& e)
{
return Error((PTCHAR)EgLib::CComErrorWrapper::ErrorDescription(e), IID_IMmRvFutColl, e.Error());
}
return S_OK;
}
示例14: GetAccessDenied
STDMETHODIMP
InterfaceGreyListingWhiteAddresses::get_Item(long Index, IInterfaceGreyListingWhiteAddress **pVal)
{
try
{
if (!gl_white_addresses_)
return GetAccessDenied();
CComObject<InterfaceGreyListingWhiteAddress>* pInterfaceGreyListingWhiteAddress = new CComObject<InterfaceGreyListingWhiteAddress>();
pInterfaceGreyListingWhiteAddress->SetAuthentication(authentication_);
shared_ptr<HM::GreyListingWhiteAddress> pBA = gl_white_addresses_->GetItem(Index);
if (!pBA)
return DISP_E_BADINDEX;
pInterfaceGreyListingWhiteAddress->AttachItem(pBA);
pInterfaceGreyListingWhiteAddress->AttachParent(gl_white_addresses_, true);
pInterfaceGreyListingWhiteAddress->AddRef();
*pVal = pInterfaceGreyListingWhiteAddress;
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例15: Add
STDMETHODIMP InterfaceDistributionLists::Add(IInterfaceDistributionList **pVal)
{
try
{
if (!m_pDistributionLists)
return GetAccessDenied();
if (!m_pDistributionLists)
return m_pAuthentication->GetAccessDenied();
CComObject<InterfaceDistributionList>* pList = new CComObject<InterfaceDistributionList>();
pList->SetAuthentication(m_pAuthentication);
shared_ptr<HM::DistributionList> pPersList = shared_ptr<HM::DistributionList>(new HM::DistributionList);
pPersList->SetDomainID(m_iDomainID);
pList->AttachItem(pPersList);
pList->AttachParent(m_pDistributionLists, false);
pList->AddRef();
*pVal = pList;
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}