隐藏进程的所有窗口(例如 Internet Explorer)

发布于 2024-08-15 15:42:59 字数 251 浏览 5 评论 0原文

我正在使用 WatiN 在 Internet Explorer 中编写在用户计算机后台运行的操作脚本。 (我知道……哈克)。我可以通过 WatiN 使 Internet Explorer 窗口不显示。但是,在我的脚本过程中,会打开一些 HTML 对话框。我可以使用 User32.dll 中的 P-Invoke ShowWindow 隐藏它们,但当我找到对话框的 HWnd 时,它们仍然会显示一秒钟左右。我的问题是:

有没有办法阻止进程显示任何窗口?

谢谢

I am using WatiN to script actions in Internet Explorer that run in the background of the user's machine. (I know...hacky). I am able through WatiN to make the Internet Explorer window not show. However, during my script, some HTML dialogs are opened. I am able to hide them using the P-Invoke ShowWindow in User32.dll, but they still appear for a second or so while I find the HWnd for the dialog. My question is:

Is there a way to stop a process from showing any windows?

Thanks

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

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

发布评论

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

评论(2

够钟 2024-08-22 15:42:59
ie.ShowWindow(NativeMethods.WindowShowStyle.Hide);
ie.ShowWindow(NativeMethods.WindowShowStyle.Hide);
·深蓝 2024-08-22 15:42:59

我假设您尝试过 WatiN 中 IE 对象的 Settings 属性上的 AutoCloseDialogs 属性?

一种选择是在不同的用户帐户下运行整个过程。我不确定是什么在调用 WatiN,但 CreateProcessAsUser 默认情况下,Windows API 会将其创建的任何进程放在单独的交互式桌面中,即不是当前用户的桌面中。 这篇博文< /a> 有一些关于从 .net 调用 CreateProcessAsUser 的信息。

I'm assuming you tried the AutoCloseDialogs property on the IE object's Settings property in WatiN?

One option would be to run the whole thing under a different user account. I'm not sure what is invoking WatiN but the CreateProcessAsUser Windows API will, by default, put whatever processes it create's in a separate interactive desktop i.e. not the current user's one. This blog post has some info on calling CreateProcessAsUser from .net.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文