Skip to content

Commit

Permalink
Updated DWMWINDOWATTRIBUTE with new Win11 values
Browse files Browse the repository at this point in the history
  • Loading branch information
dahall committed Jan 15, 2023
1 parent d442ebd commit f1a3b2d
Showing 1 changed file with 91 additions and 52 deletions.
143 changes: 91 additions & 52 deletions PInvoke/DwmApi/DwmApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,42 @@ public enum DWMTRANSITION_OWNEDWINDOW_TARGET
DWMTRANSITION_OWNEDWINDOW_REPOSITION = 0,
}

/// <summary>Flags used by the DwmSetWindowAttribute function to specify the rounded corner preference for a window.</summary>
[PInvokeData("dwmapi.h")]
/// <summary>Flags for specifying the system-drawn backdrop material of a window, including behind the non-client area.</summary>
// https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_systembackdrop_type
// typedef enum DWM_SYSTEMBACKDROP_TYPE { DWMSBT_AUTO, DWMSBT_NONE, DWMSBT_MAINWINDOW, DWMSBT_TRANSIENTWINDOW, DWMSBT_TABBEDWINDOW } ;
[PInvokeData("dwmapi.h", MSDNShortId = "NE:dwmapi.DWM_SYSTEMBACKDROP_TYPE")]
public enum DWM_SYSTEMBACKDROP_TYPE
{
/// <summary>
/// The default. Let the Desktop Window Manager (DWM) automatically decide the system-drawn backdrop material for this window.
/// </summary>
DWMSBT_AUTO,

/// <summary>Don't draw any system backdrop.</summary>
DWMSBT_NONE,

/// <summary>Draw the backdrop material effect corresponding to a long-lived window.</summary>
DWMSBT_MAINWINDOW,

/// <summary>Draw the backdrop material effect corresponding to a transient window.</summary>
DWMSBT_TRANSIENTWINDOW,

/// <summary>Draw the backdrop material effect corresponding to a window with a tabbed title bar.</summary>
DWMSBT_TABBEDWINDOW,
}

/// <summary>Flags used by the DwmSetWindowAttribute function to specify the rounded corner preference for a window.</summary>
[PInvokeData("dwmapi.h")]
public enum DWM_WINDOW_CORNER_PREFERENCE
{
/// <summary>Let the system decide when to round window corners.</summary>
DWMWCP_DEFAULT = 0,
/// <summary>Never round window corners.</summary>
DWMWCP_DONOTROUND = 1,
/// <summary>Round the corners, if appropriate.</summary>
DWMWCP_ROUND = 2,
/// <summary>Round the corners if appropriate, with a small radius.</summary>
DWMWCP_ROUNDSMALL = 3
/// <summary>Let the system decide when to round window corners.</summary>
DWMWCP_DEFAULT = 0,
/// <summary>Never round window corners.</summary>
DWMWCP_DONOTROUND = 1,
/// <summary>Round the corners, if appropriate.</summary>
DWMWCP_ROUND = 2,
/// <summary>Round the corners if appropriate, with a small radius.</summary>
DWMWCP_ROUNDSMALL = 3
}

/// <summary>
Expand Down Expand Up @@ -363,61 +387,76 @@ public enum DWMWINDOWATTRIBUTE
/// </summary>
[CorrespondingType(typeof(bool), CorrespondingAction.Set)]
DWMWA_FREEZE_REPRESENTATION,
/// <summary>
/// Use with DwmSetWindowAttribute. Enables a non-UWP window to use host backdrop brushes. If this flag is set, then a Win32 app

/// <summary>
/// Use with DwmSetWindowAttribute. Enables a non-UWP window to use host backdrop brushes. If this flag is set, then a Win32 app
/// that calls Windows::UI::Composition APIs can build transparency effects using the host backdrop brush
/// (see Compositor.CreateHostBackdropBrush). The pvAttribute parameter points to a value of type BOOL. TRUE to enable host
/// backdrop brushes for the window, or FALSE to disable it.
///<para><c>Windows 10 and earlier:</c> This value is not supported.</para>
/// </summary>
///<para>This value is supported starting with Windows 11 Build 22000.</para>
/// </summary>
[CorrespondingType(typeof(bool), CorrespondingAction.Set)]
DWMWA_USE_HOSTBACKDROPBRUSH,
/// <summary>
/// Use with DwmSetWindowAttribute. Allows the window frame for this window to be drawn in dark mode colors when the dark mode
DWMWA_USE_HOSTBACKDROPBRUSH,

/// <summary>
/// Use with DwmSetWindowAttribute. Allows the window frame for this window to be drawn in dark mode colors when the dark mode
/// system setting is enabled. For compatibility reasons, all windows default to light mode regardless of the system setting.
/// The pvAttribute parameter points to a value of type BOOL. TRUE to honor dark mode for the window, FALSE to always
/// use light mode.
/// <para><c>Windows 10 and earlier:</c> This value is not supported.</para>
/// </summary>
[CorrespondingType(typeof(bool), CorrespondingAction.Set)]
DWMWA_USE_IMMERSIVE_DARK_MODE = 20,
/// <summary>
/// Use with DwmSetWindowAttribute. Specifies the rounded corner preference for a window. The pvAttribute parameter points
/// <para>This value is supported starting with Windows 11 Build 22000.</para>
/// </summary>
[CorrespondingType(typeof(bool), CorrespondingAction.Set)]
DWMWA_USE_IMMERSIVE_DARK_MODE = 20,

/// <summary>
/// Use with DwmSetWindowAttribute. Specifies the rounded corner preference for a window. The pvAttribute parameter points
/// to a value of type DWM_WINDOW_CORNER_PREFERENCE.
/// <para><c>Windows 10 and earlier:</c> This value is not supported.</para>
/// </summary>
[CorrespondingType(typeof(DWM_WINDOW_CORNER_PREFERENCE), CorrespondingAction.Set)]
DWMWA_WINDOW_CORNER_PREFERENCE = 33,
/// <summary>
/// Use with DwmSetWindowAttribute. Specifies the color of the window border. The pvAttribute parameter points to a value
/// <para>This value is supported starting with Windows 11 Build 22000.</para>
/// </summary>
[CorrespondingType(typeof(DWM_WINDOW_CORNER_PREFERENCE), CorrespondingAction.Set)]
DWMWA_WINDOW_CORNER_PREFERENCE = 33,

/// <summary>
/// Use with DwmSetWindowAttribute. Specifies the color of the window border. The pvAttribute parameter points to a value
/// of type COLORREF. The app is responsible for changing the border color according to state changes, such as a change
/// in window activation.
/// <para><c>Windows 10 and earlier:</c> This value is not supported.</para>
/// </summary>
[CorrespondingType(typeof(COLORREF), CorrespondingAction.Set)]
DWMWA_BORDER_COLOR,
/// <summary>
/// Use with DwmSetWindowAttribute. Specifies the color of the caption. The pvAttribute parameter points to a value
/// <para>This value is supported starting with Windows 11 Build 22000.</para>
/// </summary>
[CorrespondingType(typeof(COLORREF), CorrespondingAction.Set)]
DWMWA_BORDER_COLOR,

/// <summary>
/// Use with DwmSetWindowAttribute. Specifies the color of the caption. The pvAttribute parameter points to a value
/// of type COLORREF.
/// <para><c>Windows 10 and earlier:</c> This value is not supported.</para>
/// </summary>
[CorrespondingType(typeof(COLORREF), CorrespondingAction.Set)]
DWMWA_CAPTION_COLOR,
/// <summary>
/// Use with DwmSetWindowAttribute. Specifies the color of the caption text. The pvAttribute parameter points to a value
/// <para>This value is supported starting with Windows 11 Build 22000.</para>
/// </summary>
[CorrespondingType(typeof(COLORREF), CorrespondingAction.Set)]
DWMWA_CAPTION_COLOR,

/// <summary>
/// Use with DwmSetWindowAttribute. Specifies the color of the caption text. The pvAttribute parameter points to a value
/// of type COLORREF.
/// <para><c>Windows 10 and earlier:</c> This value is not supported.</para>
/// </summary>
[CorrespondingType(typeof(COLORREF), CorrespondingAction.Set)]
DWMWA_TEXT_COLOR,
/// <summary>
/// Use with DwmGetWindowAttribute. Retrieves the width of the outer border that the DWM would draw around this window.
/// <para>This value is supported starting with Windows 11 Build 22000.</para>
/// </summary>
[CorrespondingType(typeof(COLORREF), CorrespondingAction.Set)]
DWMWA_TEXT_COLOR,

/// <summary>
/// Use with DwmGetWindowAttribute. Retrieves the width of the outer border that the DWM would draw around this window.
/// The value can vary depending on the DPI of the window. The pvAttribute parameter points to a value of type UINT.
/// <para><c>Windows 10 and earlier:</c> This value is not supported.</para>
/// </summary>
[CorrespondingType(typeof(uint), CorrespondingAction.Set)]
DWMWA_VISIBLE_FRAME_BORDER_THICKNESS
}
/// <para>This value is supported starting with Windows 11 Build 22000.</para>
/// </summary>
[CorrespondingType(typeof(uint), CorrespondingAction.Get)]
DWMWA_VISIBLE_FRAME_BORDER_THICKNESS,

/// <summary>
/// Use with DwmGetWindowAttribute or DwmSetWindowAttribute. Retrieves or specifies the system-drawn backdrop material of a
/// window, including behind the non-client area. The pvAttribute parameter points to a value of type DWM_SYSTEMBACKDROP_TYPE.
/// <para>This value is supported starting with Windows 11 Build 22621.</para>
/// </summary>
[CorrespondingType(typeof(DWM_SYSTEMBACKDROP_TYPE), CorrespondingAction.GetSet)]
DWMWA_SYSTEMBACKDROP_TYPE,
}

/// <summary>Identifies the gesture type specified in DwmRenderGesture.</summary>
[PInvokeData("dwmapi.h")]
Expand Down

0 comments on commit f1a3b2d

Please sign in to comment.