HTML文本载入HTMLDocument2进行解析
2020-12-13 06:04
标签:style blog class c code tar 至此html文件已经载入HTMLDocument2,解析代码参考上一篇:《利用WebBrowser控件实现百度自动搜索》 HTML文本载入HTMLDocument2进行解析,搜素材,soscw.com HTML文本载入HTMLDocument2进行解析 标签:style blog class c code tar 原文地址:http://blog.csdn.net/one_in_one/article/details/26375081IHTMLDocument2 *pDoc;
IHTMLElementCollection *objAllElement;
HRESULT hr;
CoInitialize(NULL);
hr = CoCreateInstance(CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER,
IID_IHTMLDocument2, (void**)&pDoc);
SAFEARRAY* psa = SafeArrayCreateVector(VT_VARIANT, 0, 1);
VARIANT *param;
bstr_t bsData = (LPCTSTR)pBuffer;//wchar_t *pBuffer;页面源码
hr = SafeArrayAccessData(psa, (LPVOID*)¶m);
param->vt = VT_BSTR;
param->bstrVal = (BSTR)bsData;
hr = pDoc->write(psa);
hr = pDoc->close();
pDoc->get_all(&objAllElement);
上一篇:十大经典排序算法