获取IE HTML文档

来源:互联网 发布:千里眼偷窥软件 编辑:程序博客网 时间:2024/06/07 02:22
获取打开IE HTML文档SHDocVw.ShellWindows shellWindows= new SHDocVw.ShellWindowsClass();string filename;foreach (SHDocVw.InternetExplorer ie in shellWindows){filename= Path.GetFileNameWithoutExtension(ie.FullName).ToLower();if (filename.Equals("iexplore")){Console.WriteLine("Web Site  : {0}", ie.LocationURL);mshtml.IHTMLDocument2 htmlDoc= ie.Document as mshtml.IHTMLDocument2;Console.WriteLine("  Document Snippet: {0}",( ( htmlDoc != null ) ? htmlDoc.body.outerHTML.Substring(0, 40): "***Failed***" ));Console.WriteLine("{0}{0}", Environment.NewLine);}}

原创粉丝点击