EnumChildWindows

2.x

  BOOL EnumChildWindows(hwndParent, wndenmprc, lParam)    
  HWND hwndParent; /* handle of parent window */
  WNDENUMPROC wndenmprc; /* address of callback function */
  LPARAM lParam; /* application-defined value */

The EnumChildWindows function enumerates the child windows that belong to the given parent window by passing the handle of each child window, in turn, to an application-defined callback function. EnumChildWindows continues until the last child window is enumerated or the callback function returns zero.

Parameters

hwndParent

Identifies the parent window whose child windows are to be enumerated.

wndenmprc

Specifies the procedure-instance address of the application-supplied callback function. The address must have been created by using the MakeProcInstance function. For more information about the callback function, see the description of the EnumChildProc callback function.

lParam

Specifies a 32-bit application-defined value to pass to the callback function.

Return Value

The return value is nonzero if the function is successful. Otherwise, it is zero.

Comments

This function does not enumerate top-level windows that belong to the parent window.

If a child window has created child windows of its own, the function enumerates those windows as well.

A child window that is moved or repositioned in the Z-order during the enumeration process will be properly enumerated. The function will not enumerate a child window that is destroyed before it is enumerated or that is created during the enumeration process. These measures ensure that the EnumChildWindows function is reliable even when the application causes odd side effects, whereas an application that uses a GetWindow loop risks being caught in an infinite loop or referencing a handle to a window that has been destroyed.

See Also

EnumChildProc, MakeProcInstance