检测另一个进程的模态对话框 [英] Detecting a modal dialog box of another process

查看:22
本文介绍了检测另一个进程的模态对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检测是否有另一个进程说 process.exe 当前正在显示一个对话框?有没有办法在 C# 中做到这一点?

I want to detect whether another process say process.exe is currently displaying a dialog box ? Is there a way to do that in C# ?

看看能不能拿到对话框的句柄.我尝试过 Spy++ 的查找窗口工具,当我尝试将查找器拖动到对话框顶部时,它没有突出显示对话框而是填充详细信息和提及 AppCustomDialogBox 并提及句柄编号

To see if I could get the handle of the dialog box. I have tried Spy++ 's find window tool, when I try to drag the finder on top of the dialog box, it does not highlight the dialogbox but populates the details and mentions AppCustomDialogBox and mentions the handle number

请告知我如何以编程方式检测..

Please advise how can I programatically detect that ..

谢谢,

推荐答案

由于模态对话框通常禁用父窗口,因此您可以枚举进程的所有顶级窗口,并查看它们是否使用 IsWindowEnabled() 函数.

As modal dialogs normally disable the parent window(s), you can enumerate all top level windows for a process and see if they're enabled using the IsWindowEnabled() function.

这篇关于检测另一个进程的模态对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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