This function enumerates all top-level windows on the screen by passing the handle to each window, in turn, to an application-defined callback function. EnumWindows continues until the last top-level window is enumerated or the callback function returns FALSE.

BOOL EnumWindows( 
LPARAM lParam ); 


  • lpEnumFunc
    Long pointer to an application-defined callback function. For more information, see EnumWindowsProc.
  • lParam
    Specifies an application-defined value to be passed to the callback function.

Return Values

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.


The EnumWindows function does not enumerate child windows.

This function is more reliable than calling the GetWindow function in a loop. An application that calls GetWindow to perform this task risks being caught in an infinite loop or referencing a handle to a window that has been destroyed.


Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Winuser.h    

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

EnumWindowsProc, GetWindow

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.