SetLayeredWindowAttributes function user32

Win32Result<bool> SetLayeredWindowAttributes(
  1. HWND hwnd,
  2. COLORREF crKey,
  3. int bAlpha,
  4. LAYERED_WINDOW_ATTRIBUTES_FLAGS dwFlags,
)

Sets the opacity and transparency color key of a layered window.

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

Implementation

Win32Result<bool> SetLayeredWindowAttributes(
  HWND hwnd,
  COLORREF crKey,
  int bAlpha,
  LAYERED_WINDOW_ATTRIBUTES_FLAGS dwFlags,
) {
  resolveGetLastError();
  final result_ = _SetLayeredWindowAttributes(hwnd, crKey, bAlpha, dwFlags);
  return .new(value: result_ != FALSE, error: GetLastError());
}