获取所有与我的窗口重叠的窗口 [英] Get all windows which overlap my window

查看:69
本文介绍了获取所有与我的窗口重叠的窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找到所有与我的窗口完全或部分重叠的窗口(位于其顶部). 作为一种特殊情况,如果我有两个窗口句柄(hWnd1和hWnd2),我想确定hWnd2是否部分或完全重叠于hWnd1. 有问题的窗口是桌面窗口(不是同一过程中的子级/兄弟级).

I want to find all windows which entirely or partly overlap my window (are on top of it). As a special case, if I have two window handles (hWnd1 and hWnd2), I want to find if hWnd2 partly or completely overlaps hWnd1. The windows in question are desktop windows (not children/siblings in the same process).

推荐答案

使用GW_HWNDPREV重复调用GetWindow()来迭代可能与您重叠的窗口.使用GetWindowRect()检查这样的窗口是否实际上与您的窗口重叠.对于两个已知的窗口没有捷径,只需检查GetWindow()在迭代时是否返回hWnd2即可.

Iterate the windows that might overlap yours by repeatedly calling GetWindow(), using GW_HWNDPREV. Use GetWindowRect() to check if such a window actually overlap yours. There's no shortcut for two known windows, just check if GetWindow() returns hWnd2 while iterating.

这篇关于获取所有与我的窗口重叠的窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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