Microsoft KB Archive/33161

{|
 * width="100%"|

HOWTO: Use the GetWindow Function

 * }

Q33161

-

The information in this article applies to:


 * Microsoft Windows Software Development Kit (SDK)
 * Microsoft Win32 Software Development Kit (SDK)

-

SUMMARY
An application can use the GetWindow function to enumerate the windows that have a specified relationship to another window. For example, an application can determine the windows that are children of the application's main window.

MORE INFORMATION
The GetWindow function returns NULL when no more windows match the specified criteria. Given a window handle, hWnd, the following code determines how many siblings the associated window has:

  int CountSiblings(HWND hWnd) {     HWND hWndNext; short nCount = 0; hWndNext = GetWindow(hWnd, GW_HWNDFIRST); while (hWndNext != NULL) {        nCount++; hWndNext = GetWindow(hWndNext, GW_HWNDNEXT); }     return nCount; } Additional query words:

Keywords : kbOSWinNT kbOSWin2000 kbGrpDSUser kbOSWin kbWndw

Issue type : kbhowto

Technology : kbWin32SDKSearch kbAudDeveloper kbSDKSearch kbWin32sSearch kbWinSDKSearch