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 厚積薄發 閱讀(3006) 評論(1) 編輯 收藏 引用 所屬分類: Windows編程