本文整理汇总了C++中msxml::IXMLDOMElementPtr::QueryInterface方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMElementPtr::QueryInterface方法的具体用法?C++ IXMLDOMElementPtr::QueryInterface怎么用?C++ IXMLDOMElementPtr::QueryInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msxml::IXMLDOMElementPtr
的用法示例。
在下文中一共展示了IXMLDOMElementPtr::QueryInterface方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetItemElement
bool CHelpDB::GetItemElement(CTSTRING& _sAlias, MSXML::IXMLDOMElementPtr& Out, bool bCreate)
{
bool r = false;
TSTRING sXPath;
MSXML::IXMLDOMNodePtr Node;
TSTRING sAlias;
{
TCHAR* tsz = _tcsdup(_sAlias.c_str());
_tcsupr(tsz);
sAlias = tsz;
SAFE_FREE(tsz);
}
// this will look something like MSG[@ALIAS="hithere"]
sprintf(sXPath, TAG_MSG _T("[@") TAG_ALIAS _T("=\"%s\"]"), sAlias.c_str());
try
{
Node = m_root->selectSingleNode(_bstr_t(sXPath.c_str()));
if((Node == NULL) && (bCreate == true))
{
MSXML::IXMLDOMElementPtr NewEl;
MSXML::IXMLDOMNodePtr NewNode;
NewEl = m_doc->createElement("MSG");
NewEl.QueryInterface(__uuidof(MSXML::IXMLDOMNode), &NewNode);
Node = m_root->appendChild(NewNode);
}
if(Node != NULL)
{
Node.QueryInterface(__uuidof(MSXML::IXMLDOMElement), &Out);
r = true;
}
}
catch(_com_error& e)
{
sprintf(m_err, _T("COM Error: %08x"), e.Error());
g_pLog->msg(_T("CHelpDB::GetItemElement(%s)"), _sAlias.c_str());
}
return r;
}
示例2: DeleteItem
bool CHelpDB::DeleteItem(CTSTRING& sAlias)
{
MSXML::IXMLDOMElementPtr El;
MSXML::IXMLDOMNodePtr Node;
MSXML::IXMLDOMNodePtr Parent;
bool r = false;
if(m_doc == 0) return false;
if(GetItemElement(sAlias, El, false))
{
El.QueryInterface(__uuidof(MSXML::IXMLDOMNode), &Node);
Parent = Node->GetparentNode();
Parent->removeChild(Node);
r = true;
}
return r;
}