tags:

views:

81

answers:

2

If I have the handles to two windows, how can I tell whether one is obscuring the other? Obviously I can easily do a collision test, but how do I test / find out their "z order"? The windows are from totally different apps.

I am probably missing something fairly obvious..

+1  A: 

WindowFromPoint, (use a point bounded by one window, and see if you get back that window's handle, or the other one).

For partial obscuration, you can use the clipping system. I discuss this in more detail on my website here

Bob Moore
A: 

This page talks about the Z ordering of windows. It doesn't mention a function to get the Z order directly, but it does point at GetNextWindow(), which given one window can return the next (or previous, don't let the name fool you) in the Z order. Using that, you should be able to figure it out.

unwind