Program A (a window) has button B in it. A toggles B from visible state to invisible state once a minute roughly, in another word, B becomes visible for a minute, then becomes invisible for a minute, then visible again for a minute and so onů

Program C checks whether B is visible or not, using isWindowVisible(hwnd) function. For C, A(and B) is a black box, all C has is the handles of A (and B).

Window D is yet another program.

The problem:

Right before B becomes visible, put D in front of B --- in this case, even B should become "visible" according to A program, it will not be "visible" for the user because D is covering B. A few seconds after A turns B into visible state, minimize D so that B can be seen from the user. However according to C,


always returns false from now on. Even after A turns B into invisible and then back to visible state, isWindowVisible(handle_of_B) still returns false when C program checks it.

The questions:

All we need to do is to find out, programmatically, whether B is visible or not by user. Is isWindowVisible the correct method to call? Should we set(or reset) some properties before we call isWindowVisible to avoid the above problem?