关闭所有浏览器窗口? [英] Close all browser windows?

查看:121
本文介绍了关闭所有浏览器窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C#应用程序(自动机器人)打开许多Internet Explorer窗口并同时访问不同的站点。

I'm working on a C# app (automated bot) to open many Internet Explorer windows and visit different sites at same time.

它用于打开几乎一个每隔10秒打开一个窗口,因此,几分钟后,我只有数百个窗口,当然,这些窗口会慢慢降低我的电脑的速度...

It uses to open almost a window every 10 seconds, so, after a few minutes, I just have hundreds of windows, which, of course, slowly down my pc quite a lot...

,我很想知道是否存在某种方法可以直接从应用程序直接关闭所有活动窗口,以便每隔几分钟就可以在线程或类似的线程中运行该代码。

So, I'm curious to know if there is some way to close all the active windows directly from my application, so that I can run that code in a thread or something like that, every some minutes.

谢谢。

推荐答案

使用 InternetExplorer 对象打开每个窗口,然后调用 Quit 完成后的方法。这样做还有一个好处,就是只关闭您打开的窗口(这样,用户或其他应用程序打开的窗口不会受到影响)。

Use the InternetExplorer object to open each window and invoke the Quit method when done. This has the added benefit of closing only the windows you opened (so that windows opened by the user or other applications are unaffected).

这篇关于关闭所有浏览器窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆