在Web浏览器控件中等待文档完成事件 [英] Waiting for Document Complete Event in Web Browser Control

查看:68
本文介绍了在Web浏览器控件中等待文档完成事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我想操纵Web浏览器控件上加载的html文档。为此,我使用browser.Navigate()方法加载html文档,我必须等到DocumentComplted事件将被引发,因为在文档完全加载之前我将无法获取文档对象
。如何使我的应用程序等待文档完全加载?

I want to manipulate the html document loaded on the web browser control. For this I am loading the html document using browser.Navigate() Method and I have to wait until DocumentComplted event will be raised as I will not be able to get the document object until the document is fully loaded. How can I make my application wait for the document to be fully loaded?

我有一个加载文档的方法,例如:

I have a method to load the document for example :

public void LoadHTML(string fileName)

public void LoadHTML(string fileName)

{

browser.Navigate(fileName);

browser.Navigate(fileName);

//现在我不希望从此方法返回,直到引发browser.DocumentComplete事件。

//now I dont want to return from this method until browser.DocumentComplete Event is raised.

}

 

任何类型的建议都将受到高度赞赏。

Any kind of suggesstion will be highly appreciated.

 

问候,

Bibek

推荐答案

你需要沉没
DWebBrowserEvents2
:: DocumentComplete(或者是NavigateComplete? 我忘了。)
You need to Sink DWebBrowserEvents2::DocumentComplete (or is it NavigateComplete?  I forget.)


这篇关于在Web浏览器控件中等待文档完成事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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