From: Arny on
How to detect if a window is fully exposed (not overlapped by another
window)?
From: Matti Vuori on
Arny <skara(a)stud.ntnu.no> wrote in news:i08gvj$uep$1(a)orkan.itea.ntnu.no:
> How to detect if a window is fully exposed (not overlapped by another
> window)?

You probably need to go through all windows with EnumWindows(), get their
rectangles (GetWindowRect())and check if they overlap your window's
rectangle.
From: Alex Blekhman on
On 28-Jun-10 7:48, Arny wrote:
> How to detect if a window is fully exposed (not overlapped by another
> window)?

This article may help:

"Determining whether your window is covered"
http://blogs.msdn.com/b/oldnewthing/archive/2003/09/02/54758.aspx

Alex
From: Leo Davidson on
On Jun 27, 10:48 pm, Arny <sk...(a)stud.ntnu.no> wrote:
> How to detect if a window is fully exposed (not overlapped by
> another window)?

I think you need to take a step back and define what you mean by
overlapped, and what you are trying to do (i.e. why you care if your
window is overlapped or not).

The two suggestions so far in this thread may not work properly on
modern versions of Windows, depending on what you actually want to do.

The first suggestion, enumerating for overlapping windows, may
incorrectly tell you your window is completely hidden when some of the
overlapping windows contain glass regions (e.g. their titlebars or
large parts of their client areas if they extend their glass into it).
Even without glass, they may also have regions which make all or part
of them transparent or translucent. (So this problem exists from Win2k
onwards.)

The second suggestion, using GetClipBox, will always tell you the
window is completely uncovered (unless it is minimized) on Vista/Win7
(with DWM/Aero/glass enabled) even if it is really completely covered
by other windows. (I just compiled it to confirm this.) The DWM used
by modern versions of Windows draws each window into a private buffer
and then composes those buffers together. The result is that GDI DCs
are rarely clipped due to overlapping windows (with DWM/Aero/glass
enabled). The article made sense in 2003 when it was written but has
caveats attached now.

Your window may also be visible, even when hidden behind other
windows, in the alt-tab or taskbar thumbnails, or if someone is using
the magnifying or thumbnail APIs to draw your window or exclude
drawing of the windows on top of your window...

Whether these things matter to you depends on what you are doing,
which is why I say you need to define what you want to test for and
why.