我想使用 mshtml(c# 代码)关闭新打开的 Internet Explorer 窗口。我将 Mshtml 与 Ie 的实例一起使用,并通过一个 url 导航并单击一个链接。单击链接后,我将在新窗口中打开文档。我想知道有什么方法可以从新打开的窗口中获取值并在获取值后关闭窗口..
提前致谢....
乌尼
我想使用 mshtml(c# 代码)关闭新打开的 Internet Explorer 窗口。我将 Mshtml 与 Ie 的实例一起使用,并通过一个 url 导航并单击一个链接。单击链接后,我将在新窗口中打开文档。我想知道有什么方法可以从新打开的窗口中获取值并在获取值后关闭窗口..
提前致谢....
乌尼
看下面的代码...
using System.Runtime.InteropServices;
// IE can be found in COM library called
// Microsoft Internet Controls:
using IE = SHDocVw.InternetExplorer;
static void OpenAndCloseIE()
{
// Get an instance of Internet Explorer:
Type objClassType = Type.GetTypeFromProgID("InternetExplorer.Application");
var instance = Activator.CreateInstance(objClassType) as IE;
// Close Internet Explorer again:
instance.Quit();
// Release instance:
System.Runtime.InteropServices.Marshal.ReleaseComObject(instance);
instance = null; // Don't forget to unreference it.
}