yehao's Blog

mfc CWebBrowser2获取网页源代码

    http://www.zhidao123.net/html/content/1/html_263.html 
    IHTMLDocument2   *objDocument=NULL;
    CComPtr<IHTMLElement> m_pBody;
    CComBSTR bstrHTMLText;
    objDocument=(IHTMLDocument2 *)m_ie.GetDocument();//m_ie是浏览器控件
    HRESULT hr=objDocument->get_body(&m_pBody);
    if (FAILED(hr))
            return;

    hr=m_pBody->get_outerHTML(&bstrHTMLText);
    if (FAILED(hr))
            return;
    CString html=bstrHTMLText.m_str;//获取到的html代码

posted on 2012-12-04 19:06 厚积薄发 阅读(2913) 评论(1)  编辑 收藏 引用 所属分类: Windows编程

评论

# re: mfc CWebBrowser2获取网页源代码[未登录] 2013-06-25 16:18 yy

这段代码 运行到第5的行 就会报内存错误怎么回事  回复  更多评论   


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


导航

<2013年6月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

统计

常用链接

留言簿

随笔分类

文章分类

文章档案

搜索

最新评论