VC++6.0/VS2008/VS2010:创建一个对话框窗体 ,右键窗体添加ActiveX控件 找到"Microsoft Web浏览器",给控件定义一个变量。
显示一个网页 变量.Navigate("http://xxxxx",NULL,NULL,NULL,NULL);
[code=cpp]
HRESULT hr;
IDispatch *pDisp;
pDisp=m_web.GetDocument();//获取控件文档接口
IHTMLDocument2 *pdoc;
hr=pDisp->QueryInterface(IID_IHTMLDocument2,(void**)&pdoc);
[/code]
IHTMLElementCollection *pColl=NULL;
hr=pdoc->get_all(&pColl);// get_all()通过文档接口获取网页元素