HTML文本载入HTMLDocument2进行解析

IHTMLDocument2 *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);

至此html文件已经载入HTMLDocument2,解析代码参考上一篇:利用WebBrowser控件实现百度自动搜索

HTML文本载入HTMLDocument2进行解析,布布扣,bubuko.com

HTML文本载入HTMLDocument2进行解析

上一篇:highchats与php结合生成动态统计图


下一篇:SpingMVC ModelAttribute的用法