本文整理汇总了C++中CComPtr::AddObjectProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ CComPtr::AddObjectProperty方法的具体用法?C++ CComPtr::AddObjectProperty怎么用?C++ CComPtr::AddObjectProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComPtr
的用法示例。
在下文中一共展示了CComPtr::AddObjectProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InstallHostExtensions
HRESULT CMultimediaExemplarObject::InstallHostExtensions(IModule* pModule)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
HRESULT hr = S_OK;
CComPtr<IThing> pHostEx;
CComBSTR bstrName;
CComBSTR bstrNameInternal;
CComPtr<IPropertyList> pMenu;
CComPtr<IPropertyList> pPeerMenu;
CComPtr<IMenuItem> pMenuItem;
hr = m_pWorld->get_Exemplar(CComBSTR("Host"), &pHostEx);
// Delete the peer menu, the current peer menu, which won't have MM additions (Approach...)
hr = pHostEx->RemoveProperty(CComBSTR("PeerMenu"));
if (FAILED(hr))
{
VWTRACE(m_pWorld, "VWMM", VWT_ERROR, "CMultimediaExemplarObject::InstallHostExtensions Unable to remove peer menu, hr = %x\n", hr);
goto ERROR_ENCOUNTERED;
}
// Now re-get the menu (this will get the avatar MM version) and re-add LogOff
hr = pHostEx->get_ObjectProperty(CComBSTR("PeerMenu"), (IObjectProperty**) &pPeerMenu);
if (FAILED(hr))
goto ERROR_ENCOUNTERED;
// make a copy (since not COPYONGET)
hr = CreateMenu(m_pWorld, &pMenu);
if (FAILED(hr))
goto ERROR_ENCOUNTERED;
hr = pPeerMenu->CopyTo(pMenu);
if (FAILED(hr))
goto ERROR_ENCOUNTERED;
// Add Log off... to peer menu list
hr = CreateMenuItemExt( m_pWorld, CComBSTR("Log off..."), 0, NULL,
CComBSTR("UpdateIsAvatarAndNotWizard"), CComBSTR("ShowLogOffDialog"),
NULL, &pMenuItem);
if (FAILED(hr))
goto ERROR_ENCOUNTERED;
// pMenuItem->put_SortOrder(MI_SORT_PRIMARY+110);
hr = pMenuItem->put_AddTargetParameter(VARIANT_TRUE);
if (FAILED(hr))
goto ERROR_ENCOUNTERED;
hr = pMenu->AddObjectProperty(pMenuItem);
if (FAILED(hr))
goto ERROR_ENCOUNTERED;
hr = pHostEx->put_ObjectProperty(CComBSTR("PeerMenu"), pMenu);
ERROR_ENCOUNTERED:
if (hr != S_OK)
VWTRACE(m_pWorld, "VWMM", VWT_ERROR, "CMultimediaExemplarObject::Install Error encountered\n");
return hr;
}