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..
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