how to get a window's direct child ( not any grandchildren) in win32?
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 ++;
}
}
精彩评论