如何确定窗口的任何部分是否对 Screen 可见? [英] How to determine if any part of the window is visible to Screen?

查看:22
本文介绍了如何确定窗口的任何部分是否对 Screen 可见?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序需要在屏幕上可见的所有窗口.如果一个窗口被其他窗口隐藏,那么我们忽略它.如果窗口的任何部分对屏幕可见,那么我们只需要这些窗口.

I have an application that needs all the windows which are visible to the screen. If a window is hidden by other windows then we ignore that. If any part of the windows is visible to the screen then only we need those windows.

那么有什么办法可以只找到那些实际上在屏幕上可见的窗口?

So is there any way to find only those windows which are Actually visible to the screen?

非常感谢.

平台:Windows

推荐答案

EnumWindows 获取所有顶级窗口

GetWindowRect - 到获取每个窗口的屏幕坐标.

GetWindowRect - to get the screen coordinates of each window.

GetWindow -比较 z 顺序,以便您可以检测哪个窗口被另一个窗口遮挡.如果您只是依赖 EnumWindow 的行为以 z 顺序优先级返回句柄,那么您可能不需要这个.

GetWindow - to compare z-orders so you can detect which window is occluded by another. You many not need this if you just rely on the behavior of EnumWindow to return handles in z-order priority.

GetDesktopWindow - 组合使用GetWindowRect,可以获得屏幕坐标.

GetDesktopWindow - combined with GetWindowRect, you can get the screen coordinates.

在这四个函数和一些检测矩形交叉点的数学之间,您可能可以找到所有未被另一个窗口遮挡或位于屏幕外的顶级窗口.

Between these four functions and some math to detect rectangle intersections, you can probably find all the top-level windows that aren't occluded by another window or are positioned off screen.

这篇关于如何确定窗口的任何部分是否对 Screen 可见?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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