EnumDesktopWindows function (winuser.h)
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.
Remarks
The EnumDesktopWindows function repeatedly invokes the lpfn callback function until the last top-level window is enumerated or the callback function returns FALSE.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | winuser.h (include Windows.h) |
Library | User32.lib |
DLL | User32.dll |
API set | ext-ms-win-ntuser-windowstation-l1-1-0 (introduced in Windows 8) |