检测在另一个应用程序中打开的消息框 [英] Detecting a message box opened in another application

查看:26
本文介绍了检测在另一个应用程序中打开的消息框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 VB.NET 中开发 Windows 服务,该服务启动执行某些工作的旧应用程序.该服务充当旧应用的包装器,允许用户自动执行其他手动操作.

I am developing a windows service, in VB.NET, that launches a legacy application that performs some work. The service acts as a wrapper around the legacy app allowing users to automate an otherwise manual operation.

一切都很好,除了旧版应用偶尔会显示一个消息框.执行此操作时,该过程将停止,直到消息框关闭.

Everything is working great, except occasionally the legacy app displays a messagebox. When it does this the process halts until the message box is closed.

由于服务将在服务器上运行,因此没有用户可以关闭消息框.

As the service will be running on a server there will be no user to close the message box.

该服务在 System.Diagnostics.Process 中启动遗留应用程序.

The service launches the legacy application in a System.Diagnostics.Process.

有没有办法检测我使用 System.Diagnostics.Process 启动的进程是否显示了消息框?有没有办法通过代码关闭消息框?

Is there way to detect that a message box has been displayed by a process that I have started using System.Diagnostics.Process? And is there a way to close the messagebox through code?

推荐答案

我还发现 EnumChildWindows 不返回 MessageBox.但是我找到了一个网站,向我展示了如何做到这一点.http://vbcity.com/forums/t/105842.aspx您想通过 GW_ENABLEDPOPUP 调用 GetWindow.它就像一个魅力.感谢 Scott Waletzko!

I also found that EnumChildWindows does not return the MessageBox. But I found a site that showed me how to do it. http://vbcity.com/forums/t/105842.aspx You want to call GetWindow passing in GW_ENABLEDPOPUP. It worked like a charm. Thanks to Scott Waletzko!

这篇关于检测在另一个应用程序中打开的消息框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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