如何获得已完成,处理等的已打开浏览器的状态 [英] How I can get the State of the Opened Browser like Done, Processing etc

查看:106
本文介绍了如何获得已完成,处理等的已打开浏览器的状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想知道通过哪种方式我们可以获得浏览器的状态。



例如我们正在进行一些操作,当它完成时,浏览器的状态显示为已完成。

或当我们执行任何操作时,状态正在处理。



实现这个的任何方式/想法?

Hi,

I want to Know the Way by means of Which we can Get the State of the Browser.

For e.g We are doing some operations and When it Completes the State of the Browser is diaplayed as done.
or When we perform any operation the state is processing.

Any Way/Ideas to implement this?

推荐答案

好的,这很棘手。你必须写一个插件,为浏览器完成这个,或者你必须抓住(附加)ie过程。从您的应用程序中,您可以使用提供的浏览器对象托管您自己的ie实例,这将更容易。



现在,处理浏览器的某个实例/即非常令人沮丧的体验,因为你必须使用一堆旧式接口(C / C ++)文件很差。其余的主要是关于铸造或更好地找到合适的类/接口。以下代码未经过测试,但暗示了正确的方向。

ok, this is tricky. you have to write a plugin, to accomplish this for a browser or you have to grab (attach to) the ie process. from within your application, you can host your own ie instance using the provided browser object which would be much easier.

now, dealing with a certain instance of the browser/ie is quite a frustrating experience, because you have to use a bunch of old fashioned interfaces (C/C++) with poor documentation. the rest is mostly about casting or better finding the appropriate classes/interfaces. the following code is not tested, but hints the right direction.
using System.Runtime.InteropServices;
using System.Web;
using Microsoft.Win32;
using mshtml;
using SHDocVw;
[...]
object o = null;
InternetExplorer ieInstance = new InternetExplorerClass();
IWebBrowserApp wb = (IWebBrowserApp)ieInstance;
wb.Navigate("http://www.google.de", ref o, ref o, ref o, ref o);
wb.Visible = true;
// wait
while (wb.Busy) ;
HTMLDocument wd = (HTMLDocument)wb.Document;
//HTML-Code
IHTMLDocument2 doc = (IHTMLDocument2)ieInstance.Document;
string sHTML = doc.body.innerHTML;
//or
HTMLDocument htmlDoc = (HTMLDocument)(ieInstance as SHDocVw.WebBrowserClass).Explorer.IWebBrowser_Document;
//inject Script to show message
htmlDoc.ParentWindow.execScript("alert(''hello world !!'')", "javascript");
// one possible cast
(ieInstance as SHDocVw.InternetExplorer).ReadyState == SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE
// another possible cast
(ieInstance as SHDocVw.WebBrowser_V1).BeforeNavigate += new DWebBrowserEvents_BeforeNavigateEventHandler(this.OnBeforeNavigate);
(ieInstance as SHDocVw.WebBrowser_V1).NavigateComplete += new DWebBrowserEvents_NavigateCompleteEventHandler(BHOIEContextMenu_NavigateComplete);


在这种情况下现在如果我们自己已经推出IE浏览器,我们想要获得相同的实例,我们可以执行操作然后我们如何做到这一点。



你有shdocvw.dll可用吗?你可以提供
In This Case Now if We Have our Own already Launched IE Browser and we Want yo Get Instance of the Same on Which we can Perform the Operation Then How we can do that.

And Do you Have shdocvw.dll available that u can provide


这篇关于如何获得已完成,处理等的已打开浏览器的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆