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).
+2
A:
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.
Hans Passant
2010-02-23 10:31:51
Note that GetWindow can return the original window, if it is brought to front during this iteration.
Don Reba
2010-02-23 10:36:35