tags:

views:

19

answers:

1

If I have a window handle, is there a win32 call or .net equilavent that will tell me what the z index is?

+1  A: 

I wasn't able to find anything that directly gives you the z-order of a window. However, you might be able to try something like the following (warning, untested!)

int zindex = 0;
HWND window = GetTopWindow(GetParent(targetwindow));
while (window != targetwindow) {
    zindex++;
    window = GetNextWindow(window, GW_HWNDNEXT);
    if (!window) {
        zindex = -1;
        break;
    }
}
Reinderien