本文整理汇总了C++中IPropertyBag::AddRef方法的典型用法代码示例。如果您正苦于以下问题:C++ IPropertyBag::AddRef方法的具体用法?C++ IPropertyBag::AddRef怎么用?C++ IPropertyBag::AddRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPropertyBag
的用法示例。
在下文中一共展示了IPropertyBag::AddRef方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ActivateXcpControl
HRESULT CXcpControlHost::ActivateXcpControl(IUnknown* pUnKnown)
{
if (pUnKnown == NULL)
{
return S_OK;
}
m_spUnknown = pUnKnown;
HRESULT hr = S_OK;
pUnKnown->QueryInterface(__uuidof(IOleObject), (void**)&m_spOleObject);
if (m_spOleObject)
{
//m_spOleObject->GetMiscStatus(DVASPECT_CONTENT, &m_dwMiscStatus);
OleRegGetMiscStatus( __uuidof(m_spOleObject), DVASPECT_CONTENT, &m_dwMiscStatus );
if (m_dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST)
{
//CComQIPtr<IOleClientSite> spClientSite(GetControllingUnknown());
IOleClientSite *spClientSite = NULL;
((ATL::CAxHostWindow *)this)->QueryInterface( __uuidof(IOleClientSite), (void **)&spClientSite );
if( NULL != spClientSite )
{
m_spOleObject->SetClientSite(spClientSite);
spClientSite->Release();
}
}
//CComQIPtr<IPersistPropertyBag> pPersist(m_spOleObject);
IPersistPropertyBag *pPersist = NULL;
m_spOleObject->QueryInterface( __uuidof(IPersistPropertyBag), (void **)&pPersist );
if ( NULL != pPersist )
{
IPropertyBag* pPropBag = (IPropertyBag*)new CXcpPropertyBag();
pPropBag->AddRef();
pPersist->Load((IPropertyBag*)pPropBag, NULL);
pPropBag->Release();
}
if (0 == (m_dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST))
{
//CComQIPtr<IOleClientSite> spClientSite(GetControllingUnknown());
IOleClientSite *spClientSite = NULL;
((ATL::CAxHostWindow *)this)->QueryInterface( __uuidof(IOleClientSite), (void **)&spClientSite);
//GetControllingUnknown()->QueryInterface( __uuidof(IOleClientSite), (void **)&spClientSite );
if( NULL != spClientSite )
{
m_spOleObject->SetClientSite(spClientSite);
spClientSite->Release();
}
}
m_dwViewObjectType = 0;
hr = m_spOleObject->QueryInterface(__uuidof(IViewObjectEx), (void**) &m_spViewObject);
if (FAILED(hr))
{
hr = m_spOleObject->QueryInterface(__uuidof(IViewObject2), (void**) &m_spViewObject);
if (SUCCEEDED(hr))
{
m_dwViewObjectType = 3;
}
}
else
{
m_dwViewObjectType = 7;
}
if (FAILED(hr))
{
hr = m_spOleObject->QueryInterface(__uuidof(IViewObject), (void**) &m_spViewObject);
if (SUCCEEDED(hr))
{
m_dwViewObjectType = 1;
}
}
//CComQIPtr<IAdviseSink> spAdviseSink(GetControllingUnknown());
IAdviseSink *spAdviseSink = NULL;
//GetControllingUnknown()->QueryInterface( __uuidof(IAdviseSink), (void **)&spAdviseSink );
((ATL::CAxHostWindow *)this)->QueryInterface( __uuidof(IAdviseSink), (void **)&spAdviseSink );
if( NULL != spAdviseSink )
{
m_spOleObject->Advise(spAdviseSink, &m_dwOleObject);
if (m_spViewObject)
{
m_spViewObject->SetAdvise(DVASPECT_CONTENT, 0, spAdviseSink);
}
spAdviseSink->Release();
}
m_spOleObject->SetHostNames(OLESTR("AXWIN"), NULL);
if ((m_dwMiscStatus & OLEMISC_INVISIBLEATRUNTIME) == 0)
{
m_spOleObject->GetExtent( DVASPECT_CONTENT, &m_hmSize );
m_pxSize.cx = m_rcPos.right - m_rcPos.left;
m_pxSize.cy = m_rcPos.bottom - m_rcPos.top;
AtlPixelToHiMetric(&m_pxSize, &m_hmSize);
m_spOleObject->SetExtent(DVASPECT_CONTENT, &m_hmSize);
//.........这里部分代码省略.........