OpenDesktop function user32

Win32Result<HDESK> OpenDesktop(
  1. PCWSTR lpszDesktop,
  2. DESKTOP_CONTROL_FLAGS dwFlags,
  3. bool fInherit,
  4. int dwDesiredAccess,
)

Opens the specified desktop object.

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

Implementation

Win32Result<HDESK> OpenDesktop(
  PCWSTR lpszDesktop,
  DESKTOP_CONTROL_FLAGS dwFlags,
  bool fInherit,
  int dwDesiredAccess,
) {
  final result_ = OpenDesktopW_Wrapper(
    lpszDesktop,
    dwFlags,
    fInherit ? TRUE : FALSE,
    dwDesiredAccess,
  );
  return .new(value: .new(result_.value.ptr), error: result_.error);
}