Skip to content

Commit f1a3b2d

Browse files
committed
Updated DWMWINDOWATTRIBUTE with new Win11 values
1 parent d442ebd commit f1a3b2d

File tree

1 file changed

+91
-52
lines changed

1 file changed

+91
-52
lines changed

PInvoke/DwmApi/DwmApi.cs

+91-52
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,42 @@ public enum DWMTRANSITION_OWNEDWINDOW_TARGET
205205
DWMTRANSITION_OWNEDWINDOW_REPOSITION = 0,
206206
}
207207

208-
/// <summary>Flags used by the DwmSetWindowAttribute function to specify the rounded corner preference for a window.</summary>
209-
[PInvokeData("dwmapi.h")]
208+
/// <summary>Flags for specifying the system-drawn backdrop material of a window, including behind the non-client area.</summary>
209+
// https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_systembackdrop_type
210+
// typedef enum DWM_SYSTEMBACKDROP_TYPE { DWMSBT_AUTO, DWMSBT_NONE, DWMSBT_MAINWINDOW, DWMSBT_TRANSIENTWINDOW, DWMSBT_TABBEDWINDOW } ;
211+
[PInvokeData("dwmapi.h", MSDNShortId = "NE:dwmapi.DWM_SYSTEMBACKDROP_TYPE")]
212+
public enum DWM_SYSTEMBACKDROP_TYPE
213+
{
214+
/// <summary>
215+
/// The default. Let the Desktop Window Manager (DWM) automatically decide the system-drawn backdrop material for this window.
216+
/// </summary>
217+
DWMSBT_AUTO,
218+
219+
/// <summary>Don't draw any system backdrop.</summary>
220+
DWMSBT_NONE,
221+
222+
/// <summary>Draw the backdrop material effect corresponding to a long-lived window.</summary>
223+
DWMSBT_MAINWINDOW,
224+
225+
/// <summary>Draw the backdrop material effect corresponding to a transient window.</summary>
226+
DWMSBT_TRANSIENTWINDOW,
227+
228+
/// <summary>Draw the backdrop material effect corresponding to a window with a tabbed title bar.</summary>
229+
DWMSBT_TABBEDWINDOW,
230+
}
231+
232+
/// <summary>Flags used by the DwmSetWindowAttribute function to specify the rounded corner preference for a window.</summary>
233+
[PInvokeData("dwmapi.h")]
210234
public enum DWM_WINDOW_CORNER_PREFERENCE
211235
{
212-
/// <summary>Let the system decide when to round window corners.</summary>
213-
DWMWCP_DEFAULT = 0,
214-
/// <summary>Never round window corners.</summary>
215-
DWMWCP_DONOTROUND = 1,
216-
/// <summary>Round the corners, if appropriate.</summary>
217-
DWMWCP_ROUND = 2,
218-
/// <summary>Round the corners if appropriate, with a small radius.</summary>
219-
DWMWCP_ROUNDSMALL = 3
236+
/// <summary>Let the system decide when to round window corners.</summary>
237+
DWMWCP_DEFAULT = 0,
238+
/// <summary>Never round window corners.</summary>
239+
DWMWCP_DONOTROUND = 1,
240+
/// <summary>Round the corners, if appropriate.</summary>
241+
DWMWCP_ROUND = 2,
242+
/// <summary>Round the corners if appropriate, with a small radius.</summary>
243+
DWMWCP_ROUNDSMALL = 3
220244
}
221245

222246
/// <summary>
@@ -363,61 +387,76 @@ public enum DWMWINDOWATTRIBUTE
363387
/// </summary>
364388
[CorrespondingType(typeof(bool), CorrespondingAction.Set)]
365389
DWMWA_FREEZE_REPRESENTATION,
366-
/// <summary>
367-
/// Use with DwmSetWindowAttribute. Enables a non-UWP window to use host backdrop brushes. If this flag is set, then a Win32 app
390+
391+
/// <summary>
392+
/// Use with DwmSetWindowAttribute. Enables a non-UWP window to use host backdrop brushes. If this flag is set, then a Win32 app
368393
/// that calls Windows::UI::Composition APIs can build transparency effects using the host backdrop brush
369394
/// (see Compositor.CreateHostBackdropBrush). The pvAttribute parameter points to a value of type BOOL. TRUE to enable host
370395
/// backdrop brushes for the window, or FALSE to disable it.
371-
///<para><c>Windows 10 and earlier:</c> This value is not supported.</para>
372-
/// </summary>
396+
///<para>This value is supported starting with Windows 11 Build 22000.</para>
397+
/// </summary>
373398
[CorrespondingType(typeof(bool), CorrespondingAction.Set)]
374-
DWMWA_USE_HOSTBACKDROPBRUSH,
375-
/// <summary>
376-
/// Use with DwmSetWindowAttribute. Allows the window frame for this window to be drawn in dark mode colors when the dark mode
399+
DWMWA_USE_HOSTBACKDROPBRUSH,
400+
401+
/// <summary>
402+
/// Use with DwmSetWindowAttribute. Allows the window frame for this window to be drawn in dark mode colors when the dark mode
377403
/// system setting is enabled. For compatibility reasons, all windows default to light mode regardless of the system setting.
378404
/// The pvAttribute parameter points to a value of type BOOL. TRUE to honor dark mode for the window, FALSE to always
379405
/// use light mode.
380-
/// <para><c>Windows 10 and earlier:</c> This value is not supported.</para>
381-
/// </summary>
382-
[CorrespondingType(typeof(bool), CorrespondingAction.Set)]
383-
DWMWA_USE_IMMERSIVE_DARK_MODE = 20,
384-
/// <summary>
385-
/// Use with DwmSetWindowAttribute. Specifies the rounded corner preference for a window. The pvAttribute parameter points
406+
/// <para>This value is supported starting with Windows 11 Build 22000.</para>
407+
/// </summary>
408+
[CorrespondingType(typeof(bool), CorrespondingAction.Set)]
409+
DWMWA_USE_IMMERSIVE_DARK_MODE = 20,
410+
411+
/// <summary>
412+
/// Use with DwmSetWindowAttribute. Specifies the rounded corner preference for a window. The pvAttribute parameter points
386413
/// to a value of type DWM_WINDOW_CORNER_PREFERENCE.
387-
/// <para><c>Windows 10 and earlier:</c> This value is not supported.</para>
388-
/// </summary>
389-
[CorrespondingType(typeof(DWM_WINDOW_CORNER_PREFERENCE), CorrespondingAction.Set)]
390-
DWMWA_WINDOW_CORNER_PREFERENCE = 33,
391-
/// <summary>
392-
/// Use with DwmSetWindowAttribute. Specifies the color of the window border. The pvAttribute parameter points to a value
414+
/// <para>This value is supported starting with Windows 11 Build 22000.</para>
415+
/// </summary>
416+
[CorrespondingType(typeof(DWM_WINDOW_CORNER_PREFERENCE), CorrespondingAction.Set)]
417+
DWMWA_WINDOW_CORNER_PREFERENCE = 33,
418+
419+
/// <summary>
420+
/// Use with DwmSetWindowAttribute. Specifies the color of the window border. The pvAttribute parameter points to a value
393421
/// of type COLORREF. The app is responsible for changing the border color according to state changes, such as a change
394422
/// in window activation.
395-
/// <para><c>Windows 10 and earlier:</c> This value is not supported.</para>
396-
/// </summary>
397-
[CorrespondingType(typeof(COLORREF), CorrespondingAction.Set)]
398-
DWMWA_BORDER_COLOR,
399-
/// <summary>
400-
/// Use with DwmSetWindowAttribute. Specifies the color of the caption. The pvAttribute parameter points to a value
423+
/// <para>This value is supported starting with Windows 11 Build 22000.</para>
424+
/// </summary>
425+
[CorrespondingType(typeof(COLORREF), CorrespondingAction.Set)]
426+
DWMWA_BORDER_COLOR,
427+
428+
/// <summary>
429+
/// Use with DwmSetWindowAttribute. Specifies the color of the caption. The pvAttribute parameter points to a value
401430
/// of type COLORREF.
402-
/// <para><c>Windows 10 and earlier:</c> This value is not supported.</para>
403-
/// </summary>
404-
[CorrespondingType(typeof(COLORREF), CorrespondingAction.Set)]
405-
DWMWA_CAPTION_COLOR,
406-
/// <summary>
407-
/// Use with DwmSetWindowAttribute. Specifies the color of the caption text. The pvAttribute parameter points to a value
431+
/// <para>This value is supported starting with Windows 11 Build 22000.</para>
432+
/// </summary>
433+
[CorrespondingType(typeof(COLORREF), CorrespondingAction.Set)]
434+
DWMWA_CAPTION_COLOR,
435+
436+
/// <summary>
437+
/// Use with DwmSetWindowAttribute. Specifies the color of the caption text. The pvAttribute parameter points to a value
408438
/// of type COLORREF.
409-
/// <para><c>Windows 10 and earlier:</c> This value is not supported.</para>
410-
/// </summary>
411-
[CorrespondingType(typeof(COLORREF), CorrespondingAction.Set)]
412-
DWMWA_TEXT_COLOR,
413-
/// <summary>
414-
/// Use with DwmGetWindowAttribute. Retrieves the width of the outer border that the DWM would draw around this window.
439+
/// <para>This value is supported starting with Windows 11 Build 22000.</para>
440+
/// </summary>
441+
[CorrespondingType(typeof(COLORREF), CorrespondingAction.Set)]
442+
DWMWA_TEXT_COLOR,
443+
444+
/// <summary>
445+
/// Use with DwmGetWindowAttribute. Retrieves the width of the outer border that the DWM would draw around this window.
415446
/// The value can vary depending on the DPI of the window. The pvAttribute parameter points to a value of type UINT.
416-
/// <para><c>Windows 10 and earlier:</c> This value is not supported.</para>
417-
/// </summary>
418-
[CorrespondingType(typeof(uint), CorrespondingAction.Set)]
419-
DWMWA_VISIBLE_FRAME_BORDER_THICKNESS
420-
}
447+
/// <para>This value is supported starting with Windows 11 Build 22000.</para>
448+
/// </summary>
449+
[CorrespondingType(typeof(uint), CorrespondingAction.Get)]
450+
DWMWA_VISIBLE_FRAME_BORDER_THICKNESS,
451+
452+
/// <summary>
453+
/// Use with DwmGetWindowAttribute or DwmSetWindowAttribute. Retrieves or specifies the system-drawn backdrop material of a
454+
/// window, including behind the non-client area. The pvAttribute parameter points to a value of type DWM_SYSTEMBACKDROP_TYPE.
455+
/// <para>This value is supported starting with Windows 11 Build 22621.</para>
456+
/// </summary>
457+
[CorrespondingType(typeof(DWM_SYSTEMBACKDROP_TYPE), CorrespondingAction.GetSet)]
458+
DWMWA_SYSTEMBACKDROP_TYPE,
459+
}
421460

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

0 commit comments

Comments
 (0)