0
我想使用mshtml(c#代码)关闭新打开的Internet Explorer窗口。 我使用了带有Ie实例的Mshtml,并通过一个URL导航并单击了一个链接。一旦我点击链接,我就会在新窗口中打开文档。我想知道有没有办法从新打开的窗口和获取的值,关闭窗口后获取的值..如何使用mshtml(c#代码)关闭新打开的Internet Explorer
在此先感谢....
乌尼
我想使用mshtml(c#代码)关闭新打开的Internet Explorer窗口。 我使用了带有Ie实例的Mshtml,并通过一个URL导航并单击了一个链接。一旦我点击链接,我就会在新窗口中打开文档。我想知道有没有办法从新打开的窗口和获取的值,关闭窗口后获取的值..如何使用mshtml(c#代码)关闭新打开的Internet Explorer
在此先感谢....
乌尼
见下面的代码...
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.
}
奖励用于清理(ReleaseComObject的) – 2013-02-12 18:23:32
这很有趣的'quit'方法是如何在[文档]的例子之一(使用https://msdn.microsoft.com /en-us/library/aa752084.aspx),但它不出现在可用方法的列表中。 – GetFree 2015-03-02 21:19:47