关于一个HTML转TXT的有关问题
关于一个HTML转TXT的问题
代码如下:
m_web.Navigate("F:\\1.html",NULL,NULL,NULL,NULL);
IHTMLDocument2* pDoc =(IHTMLDocument2*)m_web.GetDocument();
IHTMLElement* pBody;
BSTR bstrHtml;
pDoc-> get_body(&pBody);
pBody->get_innerText(&bstrHtml);
为什么一运行就出错呢,求高手指点,谢谢
------解决方案--------------------
代码如下:
m_web.Navigate("F:\\1.html",NULL,NULL,NULL,NULL);
IHTMLDocument2* pDoc =(IHTMLDocument2*)m_web.GetDocument();
IHTMLElement* pBody;
BSTR bstrHtml;
pDoc-> get_body(&pBody);
pBody->get_innerText(&bstrHtml);
为什么一运行就出错呢,求高手指点,谢谢
------解决方案--------------------
- C/C++ code
IHTMLDocument2* pDoc = NULL; GetHtmlDocument()->QueryInterface(IID_IHTMLDocument2,(void **)&pDoc); IHTMLElement* pBody = NULL; BSTR bstrHtml; if(pDoc) { pDoc-> get_body(&pBody); //} //GetHtmlDocument()->QueryInterface(IID_IHTMLElement,(void **)&pBody); if(pBody) { pBody->get_innerText(&bstrHtml); pBody->Release(); } pDoc->Release(); AfxMessageBox(CString(bstrHtml)); }