获取从ac#应用程序创建的IE popupwidow的状态

发布于 2024-08-06 02:38:25 字数 160 浏览 1 评论 0原文

我使用 C# 创建了一个 Internet Explorer 工具栏。单击该工具栏按钮后,我想打开 Internet Explorer 弹出窗口。我在表单中使用了 Web 浏览器控件及其调用脚本方法。在java脚本中,我使用window.open方法来打开新的弹出窗口。我需要在表单中确定弹出窗口是否关闭?

I have created an internet explorer toolbar using C#. On clicking on that toolbar button , I want to open internet explorer popup window. I have used web browser control with in the form and its invoke script method. With in the java script I have used window.open method to open the new window popup. I need to identify whether the popup is closed or not with in the form?.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

江挽川 2024-08-13 02:38:25

由于这是来自 Windows 应用程序内部,因此您可能会发现使用自己的(可见)WebBrowser 控件创建单独的表单更容易,并将其 Url 属性设置为您在 javascript window.open方法。

以下是如何通过按钮的单击事件执行此操作的简单示例:

private void button1_Click(object sender, EventArgs e)
{
    Form f = new Form();
    WebBrowser wb = new WebBrowser();
    wb.Url = new Uri(@"http://www.stackoverflow.com");
    wb.Dock = DockStyle.Fill;
    f.Controls.Add(wb);
    f.FormClosed += f_FormClosed;
    f.Show();
}

void f_FormClosed(object sender, FormClosedEventArgs e)
{
    MessageBox.Show("popup has closed");
}

Since this is from within a Windows application, you might find it easier to create a separate form with its own (visible) WebBrowser control, with its Url property set to whatever address you were using in the javascript window.open method.

Here is a simple example of how to do this from a button's click event:

private void button1_Click(object sender, EventArgs e)
{
    Form f = new Form();
    WebBrowser wb = new WebBrowser();
    wb.Url = new Uri(@"http://www.stackoverflow.com");
    wb.Dock = DockStyle.Fill;
    f.Controls.Add(wb);
    f.FormClosed += f_FormClosed;
    f.Show();
}

void f_FormClosed(object sender, FormClosedEventArgs e)
{
    MessageBox.Show("popup has closed");
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文