EnumWindows的问题 [英] Issue with EnumWindows

查看:44
本文介绍了EnumWindows的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用EnumWindows枚举窗口时,我的桌面上每个打开的窗口都有数百个句柄,而不是一个.

When enumerating windows using EnumWindows, I get hundreds of handles instead of one per open window on my desktop.

首先,我很好奇这是否正确.

First of all, i am curious if this is the correct behavior.

第二,尝试在启动进程之前和之后打开的窗口之间进行区别将返回15-20个新的句柄.我想知道是否有一种方法可以根据某些标志过滤这些消息,我真的只需要mainwindow句柄.

Secondly, trying to get a difference between open windows before and after launching a process returns 15-20 new handles. I am wondering if there is a way to filter these based on some flag, i really need just the mainwindow handle.

有什么想法吗?

推荐答案

要获取流程的主窗口,请使用

To get the main window of a process, use the Process.MainWindowHandle property.

要回答您的问题,您可以确切地看到所有使用Spy ++的句柄.
简而言之,许多应用程序将创建隐藏的窗口来运行消息循环.

To answer your question, you can see exactly what all of the handles are using Spy++.
In short, many applications will create hidden windows to run message loops.

这篇关于EnumWindows的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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