EnumWindows

2.x

  BOOL EnumWindows(wndenmprc, lParam)    
  WNDENUMPROC wndenmprc; /* address of callback function */
  LPARAM lParam; /* application-defined value */

The EnumWindows function enumerates all parent windows on the screen by passing the handle of each window, in turn, to an application-defined callback function. EnumWindows continues until the last parent window is enumerated or the callback function returns zero.

Parameters

wndenmprc

Specifies the procedure-instance address of the callback function. For more information, see the description of the EnumWindowsProc callback function.

lParam

Specifies a 32-bit application-defined value that is passed to the callback function.

Return Value

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

Comments

The EnumWindows function does not enumerate child windows.

EnumWindows 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.

The address passed as the wndenmprc parameter must be created by using the MakeProcInstance function.

See Also

EnumWindowsProc, MakeProcInstance