This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Download Microsoft Edge
More info about Internet Explorer and Microsoft Edge
Enumerates all top-level windows associated with the specified desktop. It passes the handle to each window, in turn, to an application-defined callback function.
Syntax
BOOL EnumDesktopWindows(
[in, optional] HDESK hDesktop,
[in] WNDENUMPROC lpfn,
[in] LPARAM lParam
Parameters
[in, optional] hDesktop
A handle to the desktop whose top-level windows are to be enumerated. This handle is returned by the
CreateDesktop,
GetThreadDesktop, OpenDesktop, or
OpenInputDesktop function, and must have the DESKTOP_READOBJECTS access right. For more information, see
Desktop Security and Access Rights.
If this parameter is NULL, the current desktop is used.
[in] lpfn
A pointer to an application-defined
EnumWindowsProc callback function.
[in] lParam
An application-defined value to be passed to the callback function.
Return value
If the function fails or is unable to perform the enumeration, the return value is zero.
To get extended error information, call
GetLastError.
You must ensure that the callback function sets SetLastError if it fails.
Windows Server 2003 and Windows XP/2000: If there are no windows on the desktop, GetLastError returns ERROR_INVALID_HANDLE.
EnumDesktopWindows function repeatedly invokes the lpfn callback function until the last top-level window is enumerated or the callback function returns FALSE.
Requirements