当我关闭使用网络浏览器的应用程序时会发生什么。以下网址使用flash播放器。
一切正常。此错误在应用程序关闭时显示。我该如何忽略它?
我知道为时已晚,但我觉得我对这个问题有一个聪明的答案。
使用这个,它对我来说很有效。 :)
webBrowser.ScriptErrorsSuppressed = true;
如果它不起作用,我们可以使用不同的方法,例如显示确认框(例如:此窗口要关闭,您要继续吗?是/否)
[DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName);
[DllImport("user32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);
private void TimerPopUp_Tick(object sender, EventArgs e)
{
IntPtr hWnd1 = FindWindowByCaption(IntPtr.Zero, "Web Browser");
if (hWnd1 != IntPtr.Zero && SetForegroundWindow(hWnd1))
{
SendKeys.Send("{Enter}");
}
}
如果有错误请看这个link https://stackoverflow.com/a/6198700/2794391.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)