EnumWindows function user32

Win32Result<bool> EnumWindows(
  1. Pointer<NativeFunction<WNDENUMPROC>> lpEnumFunc,
  2. LPARAM lParam
)

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.

To learn more, see learn.microsoft.com/windows/win32/api/winuser/nf-winuser-enumwindows.

Implementation

Win32Result<bool> EnumWindows(
  Pointer<NativeFunction<WNDENUMPROC>> lpEnumFunc,
  LPARAM lParam,
) {
  resolveGetLastError();
  final result_ = _EnumWindows(lpEnumFunc, lParam);
  return .new(value: result_ != FALSE, error: GetLastError());
}