开发者

Microsoft Windows - How can I determine if a window is an error dialog?

I need to be able to detect programatically whether a given window is an error dialog box or not. I recognize that in the extreme case this is probably impossible since it's quite subjective. I'm wondering if microsoft marks these dialog boxes in any way. ie. is there a window style, or something through MSAA, or any other characteristic of the window I could 开发者_JS百科look at to determine that a window is an error dialog. The only way I can come up with so far is to do some kind of image matching on the window icon to look for the little red dot with white x image that appears in error dialogs. It seems like there's got to be an easier way than this however. Am I missing something, or is there really no way to do this?

Thanks much.

-Nate


The window class type (#32770 for "standard" windows dialogs) will let you know if the window is a dialog - but only for standard dialogs. As for detecting the type, you might be better off looking at the text in the dialog to see if it can be matched... looking for colors alone might be pretty complicated (though it's possible...)

Take a look at something like the AutoIt Window Info tool - this gives you some data on the dialog you are looking at.

What is the context within which you are trying to do this?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜