/// <summary>
///
/// 获取IE浏览器的内容
/// 先添加2个COM对象引用来控制IE浏览器
//Microsoft HTML Object Library
//Microsoft Internet Controls
/// </summary>
void shellwindow()
{
SHDocVw.ShellWindows shellwindows = new SHDocVw.ShellWindows();
string fileName;
foreach (SHDocVw.InternetExplorer ie in shellwindows)
{
fileName = Path.GetFileNameWithoutExtension(ie.FullName).ToLower();
if (fileName.Equals("iexplore"))
{
mshtml.IHTMLDocument2 htmlDoc = ie.Document as mshtml.IHTMLDocument2;//HTML内容
this.textBox1.Text = htmlDoc.body.outerHTML;//获取URL地址
this.textBox2.Text = ie.LocationURL;//获取URL地址
break;
}
}
}