只是直接的孩子,而不是孙子女。
GetWindow (hwnd,GW_CHILD); 似乎是诀窍。
这个片段可以帮助!
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 ++; } }