using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
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(" 文件 Snippet: {0}", ((htmlDoc != null) ? htmlDoc.body.outerHtml.Substring(0, 40) : "***Failed***"));
Console.WriteLine("{0}{0}", Environment.NewLine);
}
}
}
}
}