如何打开Internet Explorer窗口,在URL上浏览并使用c#和mshtml库获取她的文档(HTMLDocument或InternetExplorer) [英] How open internet explorer window, navigate it on url and get her document(HTMLDocument or InternetExplorer) using c# and mshtml library

查看:109
本文介绍了如何打开Internet Explorer窗口,在URL上浏览并使用c#和mshtml库获取她的文档(HTMLDocument或InternetExplorer)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何打开Internet Explorer窗口或选项卡,对其进行导航,并使用c#和mshtml库获取其文档(HTMLDocument或InternetExplorer). IE对象的类型应为HTMLDocument或InternetExplorer.

How open internet explorer window or tab, navigate it and get her document(HTMLDocument or InternetExplorer) using c# and mshtml library. The type of IE object should be HTMLDocument or InternetExplorer.

推荐答案

如果要使用IE的交互式自动实例,请添加对( Microsoft Internet Controls ;

If you want an interactive-automated instance of IE add a (COM) reference to Microsoft Internet Controls;

private void Form1_Load(object sender, EventArgs e) {
    var IE = new SHDocVw.InternetExplorer();
    IE.NavigateComplete2 += new SHDocVw.DWebBrowserEvents2_NavigateComplete2EventHandler(OnNavigateComplete2);
    object URL = "http://www.stackoverflow.com";
    IE.Visible = true;
    IE.Navigate2(ref URL);
}
public void OnNavigateComplete2(object pDisp, ref object url) {
    var IE = (SHDocVw.InternetExplorer)pDisp;
    MessageBox.Show(IE.Document.Title);
}

这篇关于如何打开Internet Explorer窗口,在URL上浏览并使用c#和mshtml库获取她的文档(HTMLDocument或InternetExplorer)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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