本文整理汇总了C++中CComObject::Advise方法的典型用法代码示例。如果您正苦于以下问题:C++ CComObject::Advise方法的具体用法?C++ CComObject::Advise怎么用?C++ CComObject::Advise使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComObject
的用法示例。
在下文中一共展示了CComObject::Advise方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insertSubPath
STDMETHODIMP CPDPath::insertSubPath(long index, IPDSubPath *subPath)
{
if (subPath == NULL) return E_INVALIDARG;
CComObject<CPDSubPath>* pSubPath = (CComObject<CPDSubPath>*)subPath;
pSubPath->AddRef();
// Remove first from previous path
if (pSubPath->m_pOwnerPath != NULL)
{
pSubPath->m_pOwnerPath->removeSubPath(pSubPath);
}
pSubPath->m_pOwnerPath = this;
DWORD cookie;
pSubPath->Advise(this, &cookie);
if (index < 0)
m_subPaths.Add(pSubPath);
else
m_subPaths.InsertAt(index, pSubPath);
FireOnChanged(NOTIFY_ADD, pSubPath->GetUnknown(), DISPID_UNKNOWN);
return S_OK;
}
示例2: parseString
HRESULT CPDPath::parseString(BSTR s)
{
WCHAR* p = s;
while (*p)
{
CComObject<CPDSubPath>* pSubPath;
CComObject<CPDSubPath>::CreateInstance(&pSubPath);
if (pSubPath)
{
pSubPath->AddRef();
p = pSubPath->parseString(p);
if (p)
{
pSubPath->AddRef();
pSubPath->m_pOwnerPath = this;
DWORD cookie;
pSubPath->Advise(this, &cookie);
m_subPaths.Add(pSubPath);
}
pSubPath->Release();
if (p == NULL)
{
MessageBox(NULL, "Failed to parse path", "", MB_OK);
return E_FAIL;
}
}
}
return S_OK;
}