bho可以获得js图片等下载的事件吗?
想通过bho把一些特定的访问重定向一下
比如把http://host/xx.jpg换成http://myserver/?url=http://host/xx.jpg 这样的
看了一下bho 里好像截获的都是页面的访问、下载事件
[解决办法]
接收器实现BeforeNavigate2事件,然后把接收器advise到webbrowser的DWebBrowserEvents2连接点中。
BeforeNavigate2中可实现相关替换。
[解决办法]
HRESULT STDMETHODCALLTYPE SetSite(IUnknown* iunk) { // This is called by IE to plug us into the current web window release(); iunk->QueryInterface(IID_IWebBrowser2, (void**)&webBrowser); IConnectionPointContainer *cpc=0; iunk->QueryInterface(IID_IConnectionPointContainer, (void**)&cpc); IConnectionPoint* cp=0; if (cpc) cpc->FindConnectionPoint(DIID_DWebBrowserEvents2, &cp); DWORD cookie; HRESULT hr; if (cp) hr=cp->Advise(static_cast<IDispatch*>(this), &cookie); if (!webBrowser || !cpc || !cp || hr!=S_OK) {if (cp) cp->Release(); if (cpc) cpc->Release(); release(); return E_FAIL;} return S_OK; }
[解决办法]
http://hi.baidu.com/adoblog/blog/item/1e61c4120143f7cdc2fd7850.html
参考这个吧
[解决办法]
还有这个
http://www.cppblog.com/phenix-burn/archive/2006/08/29/11824.html