开发者

how to get a window's direct child ( not any grandchildren) in win32?

开发者 https://www.devze.com 2023-01-27 14:49 出处:网络
just the direct child, 开发者_Python百科not grandchildren.GetWindow(hwnd,GW_CHILD); seems to be the trick.This snippet could help!

just the direct child, 开发者_Python百科not grandchildren.


GetWindow(hwnd,GW_CHILD); seems to be the trick.


This snippet could help!

    HWND hChildWnd;
    long childCount = 0L;

    hChildWnd = GetWindow(hWnd, GW_CHILD);
    if(IsWindow(hChildWnd)) {
            childCount ++;
        while(hChildWnd){
            hChildWnd = GetWindow(hChildWnd, GW_HWNDNEXT);
            if(IsWindow(hChildWnd))
                childCount ++;
        }
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消