问题描述
- VC用webbrowser自动点击网页上的按钮
-
VARIANT vt;COleVariant vaUrl=_T("E:ie.html"); m_web.Navigate2(vaUrl,&vt,&vt,&vt,&vt); IDispatch *pDisp=m_web.GetDocument(); IHTMLDocument2 *pDocument; IHTMLElementCollection *pCollection; pDisp->QueryInterface(IID_IHTMLDocument2,(void**)&pDocument); HRESULT hr; hr = pDocument->get_all(&pCollection); if(hr==S_OK) { hr=pCollection->item(COleVariant("xianshi"),COleVariant((long)0),&pDisp); } if ( hr == S_OK ) { IHTMLElement *pElement; hr = pDisp->QueryInterface(IID_IHTMLElement,(void**)&pElement); if ( hr == S_OK ) { } }
解决方案
这个具体要看你什么网页,html怎么写的,才好判断。如果你什么都不会,找一个别人的代码,我看你很难搞定。
这种情况,你不如用按键精灵等傻瓜化的工具软件来操作。
解决方案二:
自动点击网页按钮
网页中自动点击他方网站上的按钮
解决方案三:
参考下这个http://blog.csdn.net/LightBoat09/article/details/5695505
时间: 2024-09-17 03:57:45