Get window index z from window handle

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

+3
source share
1 answer

I was unable to find anything that would directly give you the z-order of the window. However, you can 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;
    }
}
+3
source

Source: https://habr.com/ru/post/1750384/


All Articles