Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

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. EnumWindowscontinues until the last top-level window is enumerated or the callback function returns FALSE.

Syntax

BOOL EnumWindows( 
  WNDENUMPROC 
lpEnumFunc, 
  LPARAM 
lParam 
); 

Parameters

lpEnumFunc

[in] Long pointer to an application-defined callback function. For more information, see EnumWindowsProc.

lParam

[in, out] Specifies an application-defined value to be passed to the callback function.

Return Value

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

Remarks

The EnumWindowsfunction does not enumerate child windows.

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

Requirements

Header winuser.h
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also