惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
S
SegmentFault 最新的问题
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
DataBreaches.Net
F
Fortinet All Blogs
TaoSecurity Blog
TaoSecurity Blog
D
Docker
C
Cybersecurity and Infrastructure Security Agency CISA
K
Kaspersky official blog
宝玉的分享
宝玉的分享
腾讯CDC
Google Online Security Blog
Google Online Security Blog
Recorded Future
Recorded Future
T
The Exploit Database - CXSecurity.com
T
The Blog of Author Tim Ferriss
V
V2EX
S
Securelist
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
CERT Recently Published Vulnerability Notes
A
Arctic Wolf
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
Y
Y Combinator Blog
P
Proofpoint News Feed
T
Tor Project blog
AWS News Blog
AWS News Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
博客园 - 聂微东
T
Threat Research - Cisco Blogs
B
Blog
Attack and Defense Labs
Attack and Defense Labs
L
Lohrmann on Cybersecurity
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
N
News and Events Feed by Topic
博客园 - 司徒正美
H
Help Net Security
C
Cisco Blogs
C
Check Point Blog
S
Secure Thoughts

博客园 - liujun

几本敏捷书籍 数据不一致带来的障碍 微软将在SQL server 2008加入对Spatial的支持 Bentley GeoSpatial平台下一版本要发布的功能 使用MySQL的商业障碍 使用Oracle网络数据模型的缺点 拓扑模型研究 Scrum notes 空间数据库效率研究 在VS2005的Signing设置中不能创建新的key文件 对昨天传的gps测试程序小做了些修改 自己去年写的GPS小程序 利用MicroStation的高效绘图和建模能力给Google earth添加数据 MicroStation开发草稿 skype设置导致IIS不能启动的原因 特权模式 EVC中使用try/catch异常处理的麻烦 创建ListView控件 windows mobile程序性能考虑
使用智能指针封装类使用DOM
liujun · 2005-08-10 · via 博客园 - liujun

MSXML SDK文档的例子:

#include <stdio.h>
#import 
<msxml4.dll>
using namespace MSXML2;

int main(int argc, char* argv[])
{
   IXMLDOMDocument3Ptr pXMLDom;
   HRESULT hr;

   CoInitialize(NULL);
   hr
= pXMLDom.CreateInstance(__uuidof(DOMDocument40));
   
if (FAILED(hr)) 
   
{
      printf(
"Failed to instantiate an XML DOM.\n");
      
return -1;
   }


   pXMLDom
->async = VARIANT_FALSE; // default - true,

   
if(pXMLDom->load("stocks.xml")!=VARIANT_TRUE)
   
{
      printf(
"Failed to load stocks.xml:\n%s\n",
         (LPCSTR)pXMLDom
->parseError->Getreason());
      
return -1;
   }

   
else
      printf(
"XML DOM loaded from stocks.xml:\n%s\n"
         (LPCSTR)pXMLDom
->xml);
   pXMLDom.Release();
   CoUninitialize();
   
return 0;
}

很不幸,不能编译通过。首先也许我装的msxml4.dll里还没有IXMLDOMDocument3Ptr定义,要改为IXMLDOMDocument2Ptr。
然后看到http://www.cnblogs.com/babyblue/archive/2005/05/13/154430.html这里说释放智能指针要用pXMLDom = NULL。可是MS的例子确都用Release()。孰是孰非,我

实践下来智能指针释放应该赋NULL。