Reformatted and added enumerations and DWMWINDOWATTRIBUTE CorrespondingType attributes.

pull/10/head
David Hall 2017-12-18 17:04:20 -07:00
parent 6314243a0b
commit a93dd219a8
1 changed files with 357 additions and 84 deletions

View File

@ -15,12 +15,29 @@ namespace Vanara.PInvoke
{ {
/// <summary>A value for the fEnable member has been specified.</summary> /// <summary>A value for the fEnable member has been specified.</summary>
DWM_BB_ENABLE = 0X00000001, DWM_BB_ENABLE = 0X00000001,
/// <summary>A value for the hRgnBlur member has been specified.</summary> /// <summary>A value for the hRgnBlur member has been specified.</summary>
DWM_BB_BLURREGION = 0X00000002, DWM_BB_BLURREGION = 0X00000002,
/// <summary>A value for the fTransitionOnMaximized member has been specified.</summary> /// <summary>A value for the fTransitionOnMaximized member has been specified.</summary>
DWM_BB_TRANSITIONONMAXIMIZED = 0x00000004 DWM_BB_TRANSITIONONMAXIMIZED = 0x00000004
} }
/// <summary>Flags used by the DwmSetWindowAttribute function to specify the cloaking reason</summary>
[Flags]
[PInvokeData("dwmapi.h")]
public enum DWM_CLOAKED
{
/// <summary>The window was cloaked by its owner application.</summary>
DWM_CLOAKED_APP = 0x0000001,
/// <summary>The window was cloaked by the Shell.</summary>
DWM_CLOAKED_SHELL = 0x0000002,
/// <summary>The cloak value was inherited from its owner window.</summary>
DWM_CLOAKED_INHERITED = 0x0000004,
}
/// <summary>The display options for the live preview.</summary> /// <summary>The display options for the live preview.</summary>
[Flags] [Flags]
[PInvokeData("dwmapi.h")] [PInvokeData("dwmapi.h")]
@ -28,6 +45,7 @@ namespace Vanara.PInvoke
{ {
/// <summary>No frame is displayed around the provided thumbnail.</summary> /// <summary>No frame is displayed around the provided thumbnail.</summary>
DWM_SIT_NONE = 0x00000000, DWM_SIT_NONE = 0x00000000,
/// <summary>Displays a frame around the provided bitmap.</summary> /// <summary>Displays a frame around the provided bitmap.</summary>
DWM_SIT_DISPLAYFRAME = 0x00000001, DWM_SIT_DISPLAYFRAME = 0x00000001,
} }
@ -39,16 +57,22 @@ namespace Vanara.PInvoke
{ {
/// <summary>No visual feedback should be shown in reponse to the contact.</summary> /// <summary>No visual feedback should be shown in reponse to the contact.</summary>
DWMSC_NONE = 0x00000000, DWMSC_NONE = 0x00000000,
/// <summary>Show the "contact down" animation, such as would be used in a button press.</summary> /// <summary>Show the "contact down" animation, such as would be used in a button press.</summary>
DWMSC_DOWN = 0x00000001, DWMSC_DOWN = 0x00000001,
/// <summary>Show the "contact up" animation, such as would be used in a button release.</summary> /// <summary>Show the "contact up" animation, such as would be used in a button release.</summary>
DWMSC_UP = 0x00000002, DWMSC_UP = 0x00000002,
/// <summary>Show the "contact drag" animation when the UI element that was selected by the touch or pen is dragged.</summary> /// <summary>Show the "contact drag" animation when the UI element that was selected by the touch or pen is dragged.</summary>
DWMSC_DRAG = 0x00000004, DWMSC_DRAG = 0x00000004,
/// <summary>Show a visual while the contact is held down, such as holding down a button.</summary> /// <summary>Show a visual while the contact is held down, such as holding down a button.</summary>
DWMSC_HOLD = 0x00000008, DWMSC_HOLD = 0x00000008,
/// <summary>Show the pen barrel visual when the pen barrel button is pressed.</summary> /// <summary>Show the pen barrel visual when the pen barrel button is pressed.</summary>
DWMSC_PENBARREL = 0x00000010, DWMSC_PENBARREL = 0x00000010,
/// <summary>Show any of the animations if called for.</summary> /// <summary>Show any of the animations if called for.</summary>
DWMSC_ALL = 0xFFFFFFFF DWMSC_ALL = 0xFFFFFFFF
} }
@ -60,72 +84,200 @@ namespace Vanara.PInvoke
{ {
/// <summary>A value for the rcDestination member has been specified.</summary> /// <summary>A value for the rcDestination member has been specified.</summary>
DWM_TNP_RECTDESTINATION = 0x00000001, DWM_TNP_RECTDESTINATION = 0x00000001,
/// <summary>A value for the rcSource member has been specified.</summary> /// <summary>A value for the rcSource member has been specified.</summary>
DWM_TNP_RECTSOURCE = 0x00000002, DWM_TNP_RECTSOURCE = 0x00000002,
/// <summary>A value for the opacity member has been specified.</summary> /// <summary>A value for the opacity member has been specified.</summary>
DWM_TNP_OPACITY = 0x00000004, DWM_TNP_OPACITY = 0x00000004,
/// <summary>A value for the fVisible member has been specified.</summary> /// <summary>A value for the fVisible member has been specified.</summary>
DWM_TNP_VISIBLE = 0x00000008, DWM_TNP_VISIBLE = 0x00000008,
/// <summary>A value for the fSourceClientAreaOnly member has been specified.</summary> /// <summary>A value for the fSourceClientAreaOnly member has been specified.</summary>
DWM_TNP_SOURCECLIENTAREAONLY = 0x00000010, DWM_TNP_SOURCECLIENTAREAONLY = 0x00000010,
} }
/// <summary>Flags used by the DwmSetWindowAttribute function to specify the Flip3D window policy.</summary>
[PInvokeData("dwmapi.h")]
public enum DWMFLIP3DWINDOWPOLICY
{
/// <summary>Use the window's style and visibility settings to determine whether to hide or include the window in Flip3D rendering.</summary>
DWMFLIP3D_DEFAULT,
/// <summary>Exclude the window from Flip3D and display it below the Flip3D rendering.</summary>
DWMFLIP3D_EXCLUDEBELOW,
/// <summary>Exclude the window from Flip3D and display it above the Flip3D rendering.</summary>
DWMFLIP3D_EXCLUDEABOVE,
/// <summary>The maximum recognized DWMFLIP3DWINDOWPOLICY value, used for validation purposes.</summary>
DWMFLIP3D_LAST
}
/// <summary>Flags used by the DwmSetWindowAttribute function to specify the non-client area rendering policy.</summary>
[PInvokeData("dwmapi.h")]
public enum DWMNCRENDERINGPOLICY
{
/// <summary>The non-client rendering area is rendered based on the window style.</summary>
DWMNCRP_USEWINDOWSTYLE,
/// <summary>The non-client area rendering is disabled; the window style is ignored.</summary>
DWMNCRP_DISABLED,
/// <summary>The non-client area rendering is enabled; the window style is ignored.</summary>
DWMNCRP_ENABLED,
/// <summary>The maximum recognized DWMNCRENDERINGPOLICY value, used for validation purposes.</summary>
DWMNCRP_LAST
}
/// <summary>Identifies the target.</summary> /// <summary>Identifies the target.</summary>
[PInvokeData("dwmapi.h")] [PInvokeData("dwmapi.h")]
public enum DWMTRANSITION_OWNEDWINDOW_TARGET public enum DWMTRANSITION_OWNEDWINDOW_TARGET
{ {
/// <summary>Indicates no animation.</summary> /// <summary>Indicates no animation.</summary>
DWMTRANSITION_OWNEDWINDOW_NULL = -1, DWMTRANSITION_OWNEDWINDOW_NULL = -1,
/// <summary>Indicates that the window is repositioned.</summary> /// <summary>Indicates that the window is repositioned.</summary>
DWMTRANSITION_OWNEDWINDOW_REPOSITION = 0, DWMTRANSITION_OWNEDWINDOW_REPOSITION = 0,
} }
/// <summary>Flags used by the DwmGetWindowAttribute and DwmSetWindowAttribute functions to specify window attributes for non-client rendering.</summary> /// <summary>Flags used by the DwmGetWindowAttribute and DwmSetWindowAttribute functions to specify window attributes for non-client rendering.</summary>
[PInvokeData("dwmapi.h")] [PInvokeData("dwmapi.h")]
public enum DWMWINDOWATTRIBUTE public enum DWMWINDOWATTRIBUTE
{ {
/// <summary>Use with DwmGetWindowAttribute. Discovers whether non-client rendering is enabled. The retrieved value is of type BOOL. TRUE if non-client rendering is enabled; otherwise, FALSE.</summary> /// <summary>
/// Use with DwmGetWindowAttribute. Discovers whether non-client rendering is enabled. The retrieved value is of type BOOL. TRUE if non-client
/// rendering is enabled; otherwise, FALSE.
/// </summary>
[CorrespondingType(typeof(bool), CorrepsondingAction.Get)]
DWMWA_NCRENDERING_ENABLED = 1, DWMWA_NCRENDERING_ENABLED = 1,
/// <summary>Use with DwmSetWindowAttribute. Sets the non-client rendering policy. The pvAttribute parameter points to a value from the DWMNCRENDERINGPOLICY enumeration.</summary>
/// <summary>
/// Use with DwmSetWindowAttribute. Sets the non-client rendering policy. The pvAttribute parameter points to a value from the DWMNCRENDERINGPOLICY enumeration.
/// </summary>
[CorrespondingType(typeof(DWMNCRENDERINGPOLICY), CorrepsondingAction.Set)]
DWMWA_NCRENDERING_POLICY, DWMWA_NCRENDERING_POLICY,
/// <summary>Use with DwmSetWindowAttribute. Enables or forcibly disables DWM transitions. The pvAttribute parameter points to a value of TRUE to disable transitions or FALSE to enable transitions.</summary>
/// <summary>
/// Use with DwmSetWindowAttribute. Enables or forcibly disables DWM transitions. The pvAttribute parameter points to a value of TRUE to disable
/// transitions or FALSE to enable transitions.
/// </summary>
[CorrespondingType(typeof(bool), CorrepsondingAction.Set)]
DWMWA_TRANSITIONS_FORCEDISABLED, DWMWA_TRANSITIONS_FORCEDISABLED,
/// <summary>Use with DwmSetWindowAttribute. Enables content rendered in the non-client area to be visible on the frame drawn by DWM. The pvAttribute parameter points to a value of TRUE to enable content rendered in the non-client area to be visible on the frame; otherwise, it points to FALSE.</summary>
/// <summary>
/// Use with DwmSetWindowAttribute. Enables content rendered in the non-client area to be visible on the frame drawn by DWM. The pvAttribute
/// parameter points to a value of TRUE to enable content rendered in the non-client area to be visible on the frame; otherwise, it points to FALSE.
/// </summary>
[CorrespondingType(typeof(bool), CorrepsondingAction.Set)]
DWMWA_ALLOW_NCPAINT, DWMWA_ALLOW_NCPAINT,
/// <summary>Use with DwmGetWindowAttribute. Retrieves the bounds of the caption button area in the window-relative space. The retrieved value is of type RECT.</summary>
/// <summary>
/// Use with DwmGetWindowAttribute. Retrieves the bounds of the caption button area in the window-relative space. The retrieved value is of type RECT.
/// </summary>
[CorrespondingType(typeof(RECT), CorrepsondingAction.Get)]
DWMWA_CAPTION_BUTTON_BOUNDS, DWMWA_CAPTION_BUTTON_BOUNDS,
/// <summary>Use with DwmSetWindowAttribute. Specifies whether non-client content is right-to-left (RTL) mirrored. The pvAttribute parameter points to a value of TRUE if the non-client content is right-to-left (RTL) mirrored; otherwise, it points to FALSE.</summary>
/// <summary>
/// Use with DwmSetWindowAttribute. Specifies whether non-client content is right-to-left (RTL) mirrored. The pvAttribute parameter points to a value
/// of TRUE if the non-client content is right-to-left (RTL) mirrored; otherwise, it points to FALSE.
/// </summary>
[CorrespondingType(typeof(bool), CorrepsondingAction.Set)]
DWMWA_NONCLIENT_RTL_LAYOUT, DWMWA_NONCLIENT_RTL_LAYOUT,
/// <summary>Use with DwmSetWindowAttribute. Forces the window to display an iconic thumbnail or peek representation (a static bitmap), even if a live or snapshot representation of the window is available. This value normally is set during a window's creation and not changed throughout the window's lifetime. Some scenarios, however, might require the value to change over time. The pvAttribute parameter points to a value of TRUE to require a iconic thumbnail or peek representation; otherwise, it points to FALSE.</summary>
/// <summary>
/// Use with DwmSetWindowAttribute. Forces the window to display an iconic thumbnail or peek representation (a static bitmap), even if a live or
/// snapshot representation of the window is available. This value normally is set during a window's creation and not changed throughout the window's
/// lifetime. Some scenarios, however, might require the value to change over time. The pvAttribute parameter points to a value of TRUE to require a
/// iconic thumbnail or peek representation; otherwise, it points to FALSE.
/// </summary>
[CorrespondingType(typeof(bool), CorrepsondingAction.Set)]
DWMWA_FORCE_ICONIC_REPRESENTATION, DWMWA_FORCE_ICONIC_REPRESENTATION,
/// <summary>Use with DwmSetWindowAttribute. Sets how Flip3D treats the window. The pvAttribute parameter points to a value from the DWMFLIP3DWINDOWPOLICY enumeration.</summary>
/// <summary>
/// Use with DwmSetWindowAttribute. Sets how Flip3D treats the window. The pvAttribute parameter points to a value from the DWMFLIP3DWINDOWPOLICY enumeration.
/// </summary>
[CorrespondingType(typeof(DWMFLIP3DWINDOWPOLICY), CorrepsondingAction.Set)]
DWMWA_FLIP3D_POLICY, DWMWA_FLIP3D_POLICY,
/// <summary>Use with DwmGetWindowAttribute. Retrieves the extended frame bounds rectangle in screen space. The retrieved value is of type RECT.</summary> /// <summary>Use with DwmGetWindowAttribute. Retrieves the extended frame bounds rectangle in screen space. The retrieved value is of type RECT.</summary>
[CorrespondingType(typeof(RECT), CorrepsondingAction.Get)]
DWMWA_EXTENDED_FRAME_BOUNDS, DWMWA_EXTENDED_FRAME_BOUNDS,
/// <summary>Use with DwmSetWindowAttribute. The window will provide a bitmap for use by DWM as an iconic thumbnail or peek representation (a static bitmap) for the window. DWMWA_HAS_ICONIC_BITMAP can be specified with DWMWA_FORCE_ICONIC_REPRESENTATION. DWMWA_HAS_ICONIC_BITMAP normally is set during a window's creation and not changed throughout the window's lifetime. Some scenarios, however, might require the value to change over time. The pvAttribute parameter points to a value of TRUE to inform DWM that the window will provide an iconic thumbnail or peek representation; otherwise, it points to FALSE.
/// <para><c>Windows Vista and earlier:</c> This value is not supported.</para></summary> /// <summary>
/// Use with DwmSetWindowAttribute. The window will provide a bitmap for use by DWM as an iconic thumbnail or peek representation (a static bitmap)
/// for the window. DWMWA_HAS_ICONIC_BITMAP can be specified with DWMWA_FORCE_ICONIC_REPRESENTATION. DWMWA_HAS_ICONIC_BITMAP normally is set during a
/// window's creation and not changed throughout the window's lifetime. Some scenarios, however, might require the value to change over time. The
/// pvAttribute parameter points to a value of TRUE to inform DWM that the window will provide an iconic thumbnail or peek representation; otherwise,
/// it points to FALSE.
/// <para><c>Windows Vista and earlier:</c> This value is not supported.</para>
/// </summary>
[CorrespondingType(typeof(bool), CorrepsondingAction.Set)]
DWMWA_HAS_ICONIC_BITMAP, DWMWA_HAS_ICONIC_BITMAP,
/// <summary>Use with DwmSetWindowAttribute. Do not show peek preview for the window. The peek view shows a full-sized preview of the window when the mouse hovers over the window's thumbnail in the taskbar. If this attribute is set, hovering the mouse pointer over the window's thumbnail dismisses peek (in case another window in the group has a peek preview showing). The pvAttribute parameter points to a value of TRUE to prevent peek functionality or FALSE to allow it.
/// <para><c>Windows Vista and earlier:</c> This value is not supported.</para></summary> /// <summary>
/// Use with DwmSetWindowAttribute. Do not show peek preview for the window. The peek view shows a full-sized preview of the window when the mouse
/// hovers over the window's thumbnail in the taskbar. If this attribute is set, hovering the mouse pointer over the window's thumbnail dismisses
/// peek (in case another window in the group has a peek preview showing). The pvAttribute parameter points to a value of TRUE to prevent peek
/// functionality or FALSE to allow it.
/// <para><c>Windows Vista and earlier:</c> This value is not supported.</para>
/// </summary>
[CorrespondingType(typeof(bool), CorrepsondingAction.Set)]
DWMWA_DISALLOW_PEEK, DWMWA_DISALLOW_PEEK,
/// <summary>Use with DwmSetWindowAttribute. Prevents a window from fading to a glass sheet when peek is invoked. The pvAttribute parameter points to a value of TRUE to prevent the window from fading during another window's peek or FALSE for normal behavior.
/// <para><c>Windows Vista and earlier:</c> This value is not supported.</para></summary> /// <summary>
/// Use with DwmSetWindowAttribute. Prevents a window from fading to a glass sheet when peek is invoked. The pvAttribute parameter points to a value
/// of TRUE to prevent the window from fading during another window's peek or FALSE for normal behavior.
/// <para><c>Windows Vista and earlier:</c> This value is not supported.</para>
/// </summary>
[CorrespondingType(typeof(bool), CorrepsondingAction.Set)]
DWMWA_EXCLUDED_FROM_PEEK, DWMWA_EXCLUDED_FROM_PEEK,
/// <summary>Use with DwmGetWindowAttribute. Cloaks the window such that it is not visible to the user. The window is still composed by DWM.
/// <para><c>Using with DirectComposition:</c> Use the DWMWA_CLOAK flag to cloak the layered child window when animating a representation of the window's content via a DirectComposition visual which has been associated with the layered child window. For more details on this usage case, see How to How to animate the bitmap of a layered child window.</para> /// <summary>
/// <para><c>Windows 7 and earlier:</c> This value is not supported.</para></summary> /// Use with DwmSetWindowAttribute. Cloaks the window such that it is not visible to the user. The window is still composed by DWM.
/// <para>
/// <c>Using with DirectComposition:</c> Use the DWMWA_CLOAK flag to cloak the layered child window when animating a representation of the window's
/// content via a DirectComposition visual which has been associated with the layered child window. For more details on this usage case, see How to
/// How to animate the bitmap of a layered child window.
/// </para>
/// <para><c>Windows 7 and earlier:</c> This value is not supported.</para>
/// </summary>
[CorrespondingType(typeof(bool), CorrepsondingAction.Set)]
DWMWA_CLOAK, DWMWA_CLOAK,
/// <summary>Use with DwmGetWindowAttribute. If the window is cloaked, provides one of the following values explaining why:
/// <summary>
/// Use with DwmGetWindowAttribute. If the window is cloaked, provides one of the following values explaining why:
/// <list type="table"> /// <list type="table">
/// <listheader><term>Name (Value)</term><definition>Meaning</definition></listheader> /// <listheader>
/// <item><term>DWM_CLOAKED_APP 0x0000001</term><definition>The window was cloaked by its owner application.</definition></item> /// <term>Name (Value)</term>
/// <item><term>DWM_CLOAKED_SHELL 0x0000002</term><definition>The window was cloaked by the Shell.</definition></item> /// <definition>Meaning</definition>
/// <item><term>DWM_CLOAKED_INHERITED 0x0000004</term><definition>The cloak value was inherited from its owner window.</definition></item> /// </listheader>
/// <item>
/// <term>DWM_CLOAKED_APP 0x0000001</term>
/// <definition>The window was cloaked by its owner application.</definition>
/// </item>
/// <item>
/// <term>DWM_CLOAKED_SHELL 0x0000002</term>
/// <definition>The window was cloaked by the Shell.</definition>
/// </item>
/// <item>
/// <term>DWM_CLOAKED_INHERITED 0x0000004</term>
/// <definition>The cloak value was inherited from its owner window.</definition>
/// </item>
/// </list> /// </list>
/// <para><c>Windows 7 and earlier:</c> This value is not supported.</para></summary> /// <para><c>Windows 7 and earlier:</c> This value is not supported.</para>
/// </summary>
[CorrespondingType(typeof(DWM_CLOAKED), CorrepsondingAction.Get)]
DWMWA_CLOAKED, DWMWA_CLOAKED,
/// <summary>Use with DwmSetWindowAttribute. Freeze the window's thumbnail image with its current visuals. Do no further live updates on the thumbnail image to match the window's contents.
/// <para><c>Windows 7 and earlier:</c> This value is not supported.</para></summary> /// <summary>
/// Use with DwmSetWindowAttribute. Freeze the window's thumbnail image with its current visuals. Do no further live updates on the thumbnail image
/// to match the window's contents.
/// <para><c>Windows 7 and earlier:</c> This value is not supported.</para>
/// </summary>
[CorrespondingType(typeof(bool), CorrepsondingAction.Set)]
DWMWA_FREEZE_REPRESENTATION, DWMWA_FREEZE_REPRESENTATION,
} }
@ -135,27 +287,36 @@ namespace Vanara.PInvoke
{ {
/// <summary>A pen tap.</summary> /// <summary>A pen tap.</summary>
GT_PEN_TAP = 0, GT_PEN_TAP = 0,
/// <summary>A pen double tap.</summary> /// <summary>A pen double tap.</summary>
GT_PEN_DOUBLETAP = 1, GT_PEN_DOUBLETAP = 1,
/// <summary>A pen right tap.</summary> /// <summary>A pen right tap.</summary>
GT_PEN_RIGHTTAP = 2, GT_PEN_RIGHTTAP = 2,
/// <summary>A pen press and hold.</summary> /// <summary>A pen press and hold.</summary>
GT_PEN_PRESSANDHOLD = 3, GT_PEN_PRESSANDHOLD = 3,
/// <summary>An abort of the pen press and hold.</summary> /// <summary>An abort of the pen press and hold.</summary>
GT_PEN_PRESSANDHOLDABORT = 4, GT_PEN_PRESSANDHOLDABORT = 4,
/// <summary>A touch tap.</summary> /// <summary>A touch tap.</summary>
GT_TOUCH_TAP = 5, GT_TOUCH_TAP = 5,
/// <summary>A touch double tap.</summary> /// <summary>A touch double tap.</summary>
GT_TOUCH_DOUBLETAP = 6, GT_TOUCH_DOUBLETAP = 6,
/// <summary>A touch right tap.</summary> /// <summary>A touch right tap.</summary>
GT_TOUCH_RIGHTTAP = 7, GT_TOUCH_RIGHTTAP = 7,
/// <summary>A touch press and hold.</summary> /// <summary>A touch press and hold.</summary>
GT_TOUCH_PRESSANDHOLD = 8, GT_TOUCH_PRESSANDHOLD = 8,
/// <summary>An abort of the touch press and hold.</summary> /// <summary>An abort of the touch press and hold.</summary>
GT_TOUCH_PRESSANDHOLDABORT = 9, GT_TOUCH_PRESSANDHOLDABORT = 9,
/// <summary>A touch press and tap.</summary> /// <summary>A touch press and tap.</summary>
GT_TOUCH_PRESSANDTAP = 10 GT_TOUCH_PRESSANDTAP = 10
} }
/// <summary>Default window procedure for Desktop Window Manager (DWM) hit testing within the non-client area.</summary> /// <summary>Default window procedure for Desktop Window Manager (DWM) hit testing within the non-client area.</summary>
@ -193,7 +354,9 @@ namespace Vanara.PInvoke
[PInvokeData("dwmapi.h")] [PInvokeData("dwmapi.h")]
public static extern HRESULT DwmEnableComposition(int uCompositionAction); public static extern HRESULT DwmEnableComposition(int uCompositionAction);
/// <summary>Notifies the Desktop Window Manager (DWM) to opt in to or out of Multimedia Class Schedule Service (MMCSS) scheduling while the calling process is alive.</summary> /// <summary>
/// Notifies the Desktop Window Manager (DWM) to opt in to or out of Multimedia Class Schedule Service (MMCSS) scheduling while the calling process is alive.
/// </summary>
/// <param name="fEnableMMCSS">TRUE to instruct DWM to participate in MMCSS scheduling; FALSE to opt out or end participation in MMCSS scheduling.</param> /// <param name="fEnableMMCSS">TRUE to instruct DWM to participate in MMCSS scheduling; FALSE to opt out or end participation in MMCSS scheduling.</param>
/// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns> /// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[DllImport(Lib.DwmApi, ExactSpelling = true)] [DllImport(Lib.DwmApi, ExactSpelling = true)]
@ -209,15 +372,27 @@ namespace Vanara.PInvoke
[PInvokeData("dwmapi.h")] [PInvokeData("dwmapi.h")]
public static extern HRESULT DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMarInset); public static extern HRESULT DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMarInset);
/// <summary>Issues a flush call that blocks the caller until the next present, when all of the Microsoft DirectX surface updates that are currently outstanding have been made. This compensates for very complex scenes or calling processes with very low priority.</summary> /// <summary>
/// Issues a flush call that blocks the caller until the next present, when all of the Microsoft DirectX surface updates that are currently outstanding
/// have been made. This compensates for very complex scenes or calling processes with very low priority.
/// </summary>
/// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns> /// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[DllImport(Lib.DwmApi, ExactSpelling = true)] [DllImport(Lib.DwmApi, ExactSpelling = true)]
[PInvokeData("dwmapi.h")] [PInvokeData("dwmapi.h")]
public static extern HRESULT DwmFlush(); public static extern HRESULT DwmFlush();
/// <summary>Retrieves the current color used for Desktop Window Manager (DWM) glass composition. This value is based on the current color scheme and can be modified by the user. Applications can listen for color changes by handling the WM_DWMCOLORIZATIONCOLORCHANGED notification.</summary> /// <summary>
/// <param name="pcrColorization">A pointer to a value that, when this function returns successfully, receives the current color used for glass composition. The color format of the value is 0xAARRGGBB.</param> /// Retrieves the current color used for Desktop Window Manager (DWM) glass composition. This value is based on the current color scheme and can be
/// <param name="pfOpaqueBlend">A pointer to a value that, when this function returns successfully, indicates whether the color is an opaque blend. TRUE if the color is an opaque blend; otherwise, FALSE.</param> /// modified by the user. Applications can listen for color changes by handling the WM_DWMCOLORIZATIONCOLORCHANGED notification.
/// </summary>
/// <param name="pcrColorization">
/// A pointer to a value that, when this function returns successfully, receives the current color used for glass composition. The color format of the
/// value is 0xAARRGGBB.
/// </param>
/// <param name="pfOpaqueBlend">
/// A pointer to a value that, when this function returns successfully, indicates whether the color is an opaque blend. TRUE if the color is an opaque
/// blend; otherwise, FALSE.
/// </param>
/// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns> /// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[DllImport(Lib.DwmApi, ExactSpelling = true)] [DllImport(Lib.DwmApi, ExactSpelling = true)]
[PInvokeData("dwmapi.h")] [PInvokeData("dwmapi.h")]
@ -232,16 +407,26 @@ namespace Vanara.PInvoke
public static extern HRESULT DwmGetColorizationParameters(ref DWM_COLORIZATION_PARAMS parameters); public static extern HRESULT DwmGetColorizationParameters(ref DWM_COLORIZATION_PARAMS parameters);
/// <summary>Retrieves the current composition timing information for a specified window.</summary> /// <summary>Retrieves the current composition timing information for a specified window.</summary>
/// <param name="hwnd">The handle to the window for which the composition timing information should be retrieved. Starting with Windows 8.1, this parameter must be set to NULL. If this parameter is not set to NULL, DwmGetCompositionTimingInfo returns E_INVALIDARG.</param> /// <param name="hwnd">
/// <param name="dwAttribute">A pointer to a DWM_TIMING_INFO structure that, when this function returns successfully, receives the current composition timing information for the window. The cbSize member of this structure must be set before this function is called.</param> /// The handle to the window for which the composition timing information should be retrieved. Starting with Windows 8.1, this parameter must be set to
/// NULL. If this parameter is not set to NULL, DwmGetCompositionTimingInfo returns E_INVALIDARG.
/// </param>
/// <param name="dwAttribute">
/// A pointer to a DWM_TIMING_INFO structure that, when this function returns successfully, receives the current composition timing information for the
/// window. The cbSize member of this structure must be set before this function is called.
/// </param>
/// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns> /// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[DllImport(Lib.DwmApi, ExactSpelling = true)] [DllImport(Lib.DwmApi, ExactSpelling = true)]
[PInvokeData("dwmapi.h")] [PInvokeData("dwmapi.h")]
public static extern HRESULT DwmGetCompositionTimingInfo(IntPtr hwnd, ref DWM_TIMING_INFO dwAttribute); public static extern HRESULT DwmGetCompositionTimingInfo(IntPtr hwnd, ref DWM_TIMING_INFO dwAttribute);
/// <summary>Retrieves transport attributes.</summary> /// <summary>Retrieves transport attributes.</summary>
/// <param name="pfIsRemoting">A pointer to a BOOL value that indicates whether the transport supports remoting. TRUE if the transport supports remoting; otherwise, FALSE.</param> /// <param name="pfIsRemoting">
/// <param name="pfIsConnected">A pointer to a BOOL value that indicates whether the transport is connected. TRUE if the transport is connected; otherwise, FALSE.</param> /// A pointer to a BOOL value that indicates whether the transport supports remoting. TRUE if the transport supports remoting; otherwise, FALSE.
/// </param>
/// <param name="pfIsConnected">
/// A pointer to a BOOL value that indicates whether the transport is connected. TRUE if the transport is connected; otherwise, FALSE.
/// </param>
/// <param name="pDwGeneration">A pointer to a DWORD that receives a generation value for the transport.</param> /// <param name="pDwGeneration">A pointer to a DWORD that receives a generation value for the transport.</param>
/// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns> /// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[DllImport(Lib.DwmApi, ExactSpelling = true)] [DllImport(Lib.DwmApi, ExactSpelling = true)]
@ -266,8 +451,8 @@ namespace Vanara.PInvoke
/// <param name="hwnd">The handle to the window from which the attribute data is retrieved.</param> /// <param name="hwnd">The handle to the window from which the attribute data is retrieved.</param>
/// <param name="dwAttribute">The attribute to retrieve, specified as a DWMWINDOWATTRIBUTE value.</param> /// <param name="dwAttribute">The attribute to retrieve, specified as a DWMWINDOWATTRIBUTE value.</param>
/// <param name="pvAttribute"> /// <param name="pvAttribute">
/// A value that, when this function returns successfully, receives the current value of the attribute. The type of the retrieved value /// A value that, when this function returns successfully, receives the current value of the attribute. The type of the retrieved value depends on the
/// depends on the value of the dwAttribute parameter. /// value of the dwAttribute parameter.
/// </param> /// </param>
/// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns> /// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[PInvokeData("dwmapi.h")] [PInvokeData("dwmapi.h")]
@ -277,14 +462,22 @@ namespace Vanara.PInvoke
if (!(typeof(T) == typeof(RECT) || isBool || typeof(T) == typeof(int) || typeof(T).IsEnum)) throw new ArgumentException(); if (!(typeof(T) == typeof(RECT) || isBool || typeof(T) == typeof(int) || typeof(T).IsEnum)) throw new ArgumentException();
var m = new SafeCoTaskMemHandle(Marshal.SizeOf(isBool ? typeof(uint) : typeof(T))); var m = new SafeCoTaskMemHandle(Marshal.SizeOf(isBool ? typeof(uint) : typeof(T)));
var hr = DwmGetWindowAttribute(hwnd, dwAttribute, (IntPtr)m, m.Size); var hr = DwmGetWindowAttribute(hwnd, dwAttribute, (IntPtr)m, m.Size);
pvAttribute = isBool ? (T) Convert.ChangeType(m.ToStructure<uint>(), typeof(bool)) : m.ToStructure<T>(); pvAttribute = isBool ? (T)Convert.ChangeType(m.ToStructure<uint>(), typeof(bool)) : m.ToStructure<T>();
return hr; return hr;
} }
/// <summary>Called by an application to indicate that all previously provided iconic bitmaps from a window, both thumbnails and peek representations, should be refreshed.</summary> /// <summary>
/// <param name="hwnd">A handle to the window or tab whose bitmaps are being invalidated through this call. This window must belong to the calling process.</param> /// Called by an application to indicate that all previously provided iconic bitmaps from a window, both thumbnails and peek representations, should be refreshed.
/// </summary>
/// <param name="hwnd">
/// A handle to the window or tab whose bitmaps are being invalidated through this call. This window must belong to the calling process.
/// </param>
/// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns> /// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
/// <remarks>Calling this function causes the Desktop Window Manager (DWM) to invalidate its current bitmaps for the window and request new bitmaps from the window when they are next needed. DwmInvalidateIconicBitmaps should not be called frequently. Doing so can lead to poor performance as new bitmaps are created and retrieved.</remarks> /// <remarks>
/// Calling this function causes the Desktop Window Manager (DWM) to invalidate its current bitmaps for the window and request new bitmaps from the
/// window when they are next needed. DwmInvalidateIconicBitmaps should not be called frequently. Doing so can lead to poor performance as new bitmaps
/// are created and retrieved.
/// </remarks>
[DllImport(Lib.DwmApi, ExactSpelling = true)] [DllImport(Lib.DwmApi, ExactSpelling = true)]
[PInvokeData("dwmapi.h")] [PInvokeData("dwmapi.h")]
public static extern HRESULT DwmInvalidateIconicBitmaps(IntPtr hwnd); public static extern HRESULT DwmInvalidateIconicBitmaps(IntPtr hwnd);
@ -316,15 +509,23 @@ namespace Vanara.PInvoke
public static extern HRESULT DwmQueryThumbnailSourceSize(IntPtr hThumbnail, ref SIZE pSize); public static extern HRESULT DwmQueryThumbnailSourceSize(IntPtr hThumbnail, ref SIZE pSize);
/// <summary>Creates a Desktop Window Manager (DWM) thumbnail relationship between the destination and source windows.</summary> /// <summary>Creates a Desktop Window Manager (DWM) thumbnail relationship between the destination and source windows.</summary>
/// <param name="hwndDestination">The handle to the window that will use the DWM thumbnail. Setting the destination window handle to anything other than a top-level window type will result in a return value of E_INVALIDARG.</param> /// <param name="hwndDestination">
/// <param name="hwndSource">The handle to the window to use as the thumbnail source. Setting the source window handle to anything other than a top-level window type will result in a return value of E_INVALIDARG.</param> /// The handle to the window that will use the DWM thumbnail. Setting the destination window handle to anything other than a top-level window type will
/// result in a return value of E_INVALIDARG.
/// </param>
/// <param name="hwndSource">
/// The handle to the window to use as the thumbnail source. Setting the source window handle to anything other than a top-level window type will result
/// in a return value of E_INVALIDARG.
/// </param>
/// <param name="phThumbnailId">A pointer to a handle that, when this function returns successfully, represents the registration of the DWM thumbnail.</param> /// <param name="phThumbnailId">A pointer to a handle that, when this function returns successfully, represents the registration of the DWM thumbnail.</param>
/// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns> /// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[DllImport(Lib.DwmApi, ExactSpelling = true)] [DllImport(Lib.DwmApi, ExactSpelling = true)]
[PInvokeData("dwmapi.h")] [PInvokeData("dwmapi.h")]
public static extern HRESULT DwmRegisterThumbnail(IntPtr hwndDestination, IntPtr hwndSource, out IntPtr phThumbnailId); public static extern HRESULT DwmRegisterThumbnail(IntPtr hwndDestination, IntPtr hwndSource, out IntPtr phThumbnailId);
/// <summary>Notifies Desktop Window Manager (DWM) that a touch contact has been recognized as a gesture, and that DWM should draw feedback for that gesture.</summary> /// <summary>
/// Notifies Desktop Window Manager (DWM) that a touch contact has been recognized as a gesture, and that DWM should draw feedback for that gesture.
/// </summary>
/// <param name="gt">The type of gesture, specified as one of the GESTURE_TYPE values.</param> /// <param name="gt">The type of gesture, specified as one of the GESTURE_TYPE values.</param>
/// <param name="cContacts">The number of contact points.</param> /// <param name="cContacts">The number of contact points.</param>
/// <param name="pdwPointerID">The pointer ID.</param> /// <param name="pdwPointerID">The pointer ID.</param>
@ -343,27 +544,42 @@ namespace Vanara.PInvoke
[PInvokeData("dwmapi.h")] [PInvokeData("dwmapi.h")]
public static extern HRESULT DwmSetColorizationParameters(ref DWM_COLORIZATION_PARAMS parameters, uint unk); public static extern HRESULT DwmSetColorizationParameters(ref DWM_COLORIZATION_PARAMS parameters, uint unk);
/// <summary>Sets a static, iconic bitmap to display a live preview (also known as a Peek preview) of a window or tab. The taskbar can use this bitmap to show a full-sized preview of a window or tab.</summary> /// <summary>
/// Sets a static, iconic bitmap to display a live preview (also known as a Peek preview) of a window or tab. The taskbar can use this bitmap to show a
/// full-sized preview of a window or tab.
/// </summary>
/// <param name="hwnd">A handle to the window. This window must belong to the calling process.</param> /// <param name="hwnd">A handle to the window. This window must belong to the calling process.</param>
/// <param name="hbmp">A handle to the bitmap to represent the window that hwnd specifies.</param> /// <param name="hbmp">A handle to the bitmap to represent the window that hwnd specifies.</param>
/// <param name="pptClient">The offset of a tab window's client region (the content area inside the client window frame) from the host window's frame. This offset enables the tab window's contents to be drawn correctly in a live preview when it is drawn without its frame.</param> /// <param name="pptClient">
/// The offset of a tab window's client region (the content area inside the client window frame) from the host window's frame. This offset enables the
/// tab window's contents to be drawn correctly in a live preview when it is drawn without its frame.
/// </param>
/// <param name="dwSITFlags">The display options for the live preview.</param> /// <param name="dwSITFlags">The display options for the live preview.</param>
/// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns> /// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[DllImport(Lib.DwmApi, ExactSpelling = true)] [DllImport(Lib.DwmApi, ExactSpelling = true)]
[PInvokeData("dwmapi.h")] [PInvokeData("dwmapi.h")]
public static extern HRESULT DwmSetIconicLivePreviewBitmap(IntPtr hwnd, IntPtr hbmp, ref System.Drawing.Point pptClient, DWM_SETICONICPREVIEW_Flags dwSITFlags); public static extern HRESULT DwmSetIconicLivePreviewBitmap(IntPtr hwnd, IntPtr hbmp, ref System.Drawing.Point pptClient, DWM_SETICONICPREVIEW_Flags dwSITFlags);
/// <summary>Sets a static, iconic bitmap to display a live preview (also known as a Peek preview) of a window or tab. The taskbar can use this bitmap to show a full-sized preview of a window or tab.</summary> /// <summary>
/// Sets a static, iconic bitmap to display a live preview (also known as a Peek preview) of a window or tab. The taskbar can use this bitmap to show a
/// full-sized preview of a window or tab.
/// </summary>
/// <param name="hwnd">A handle to the window. This window must belong to the calling process.</param> /// <param name="hwnd">A handle to the window. This window must belong to the calling process.</param>
/// <param name="hbmp">A handle to the bitmap to represent the window that hwnd specifies.</param> /// <param name="hbmp">A handle to the bitmap to represent the window that hwnd specifies.</param>
/// <param name="pptClient">The offset of a tab window's client region (the content area inside the client window frame) from the host window's frame. This offset enables the tab window's contents to be drawn correctly in a live preview when it is drawn without its frame.</param> /// <param name="pptClient">
/// The offset of a tab window's client region (the content area inside the client window frame) from the host window's frame. This offset enables the
/// tab window's contents to be drawn correctly in a live preview when it is drawn without its frame.
/// </param>
/// <param name="dwSITFlags">The display options for the live preview.</param> /// <param name="dwSITFlags">The display options for the live preview.</param>
/// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns> /// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[DllImport(Lib.DwmApi, ExactSpelling = true)] [DllImport(Lib.DwmApi, ExactSpelling = true)]
[PInvokeData("dwmapi.h")] [PInvokeData("dwmapi.h")]
public static extern HRESULT DwmSetIconicLivePreviewBitmap(IntPtr hwnd, IntPtr hbmp, IntPtr pptClient, DWM_SETICONICPREVIEW_Flags dwSITFlags); public static extern HRESULT DwmSetIconicLivePreviewBitmap(IntPtr hwnd, IntPtr hbmp, IntPtr pptClient, DWM_SETICONICPREVIEW_Flags dwSITFlags);
/// <summary>Sets a static, iconic bitmap on a window or tab to use as a thumbnail representation. The taskbar can use this bitmap as a thumbnail switch target for the window or tab.</summary> /// <summary>
/// Sets a static, iconic bitmap on a window or tab to use as a thumbnail representation. The taskbar can use this bitmap as a thumbnail switch target
/// for the window or tab.
/// </summary>
/// <param name="hwnd">A handle to the window. This window must belong to the calling process.</param> /// <param name="hwnd">A handle to the window. This window must belong to the calling process.</param>
/// <param name="hbmp">A handle to the bitmap to represent the window that hwnd specifies.</param> /// <param name="hbmp">A handle to the bitmap to represent the window that hwnd specifies.</param>
/// <param name="dwSITFlags">The display options for the live preview.</param> /// <param name="dwSITFlags">The display options for the live preview.</param>
@ -374,8 +590,13 @@ namespace Vanara.PInvoke
/// <summary>Sets the value of non-client rendering attributes for a window.</summary> /// <summary>Sets the value of non-client rendering attributes for a window.</summary>
/// <param name="hwnd">The handle to the window that will receive the attributes.</param> /// <param name="hwnd">The handle to the window that will receive the attributes.</param>
/// <param name="dwAttribute">A single DWMWINDOWATTRIBUTE flag to apply to the window. This parameter specifies the attribute and the pvAttribute parameter points to the value of that attribute.</param> /// <param name="dwAttribute">
/// <param name="pvAttribute">A pointer to the value of the attribute specified in the dwAttribute parameter. Different DWMWINDOWATTRIBUTE flags require different value types.</param> /// A single DWMWINDOWATTRIBUTE flag to apply to the window. This parameter specifies the attribute and the pvAttribute parameter points to the value of
/// that attribute.
/// </param>
/// <param name="pvAttribute">
/// A pointer to the value of the attribute specified in the dwAttribute parameter. Different DWMWINDOWATTRIBUTE flags require different value types.
/// </param>
/// <param name="cbAttribute">The size, in bytes, of the value type pointed to by the pvAttribute parameter.</param> /// <param name="cbAttribute">The size, in bytes, of the value type pointed to by the pvAttribute parameter.</param>
/// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns> /// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[DllImport(Lib.DwmApi, ExactSpelling = true)] [DllImport(Lib.DwmApi, ExactSpelling = true)]
@ -385,8 +606,13 @@ namespace Vanara.PInvoke
/// <summary>Sets the value of non-client rendering attributes for a window.</summary> /// <summary>Sets the value of non-client rendering attributes for a window.</summary>
/// <param name="hwnd">The handle to the window that will receive the attributes.</param> /// <param name="hwnd">The handle to the window that will receive the attributes.</param>
/// <param name="dwAttribute">A single DWMWINDOWATTRIBUTE flag to apply to the window. This parameter specifies the attribute and the pvAttribute parameter points to the value of that attribute.</param> /// <param name="dwAttribute">
/// <param name="pvAttribute">The value of the attribute specified in the dwAttribute parameter. Different DWMWINDOWATTRIBUTE flags require different value types.</param> /// A single DWMWINDOWATTRIBUTE flag to apply to the window. This parameter specifies the attribute and the pvAttribute parameter points to the value of
/// that attribute.
/// </param>
/// <param name="pvAttribute">
/// The value of the attribute specified in the dwAttribute parameter. Different DWMWINDOWATTRIBUTE flags require different value types.
/// </param>
/// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns> /// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[PInvokeData("dwmapi.h")] [PInvokeData("dwmapi.h")]
public static HRESULT DwmSetWindowAttribute<T>(IntPtr hwnd, DWMWINDOWATTRIBUTE dwAttribute, [In] T pvAttribute) public static HRESULT DwmSetWindowAttribute<T>(IntPtr hwnd, DWMWINDOWATTRIBUTE dwAttribute, [In] T pvAttribute)
@ -421,14 +647,19 @@ namespace Vanara.PInvoke
public static extern void DwmTransitionOwnedWindow(IntPtr hwnd, DWMTRANSITION_OWNEDWINDOW_TARGET target); public static extern void DwmTransitionOwnedWindow(IntPtr hwnd, DWMTRANSITION_OWNEDWINDOW_TARGET target);
/// <summary>Removes a Desktop Window Manager (DWM) thumbnail relationship created by the DwmRegisterThumbnail function.</summary> /// <summary>Removes a Desktop Window Manager (DWM) thumbnail relationship created by the DwmRegisterThumbnail function.</summary>
/// <param name="hThumbnailId">The handle to the thumbnail relationship to be removed. Null or non-existent handles will result in a return value of E_INVALIDARG.</param> /// <param name="hThumbnailId">
/// The handle to the thumbnail relationship to be removed. Null or non-existent handles will result in a return value of E_INVALIDARG.
/// </param>
/// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns> /// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[DllImport(Lib.DwmApi, ExactSpelling = true)] [DllImport(Lib.DwmApi, ExactSpelling = true)]
[PInvokeData("dwmapi.h")] [PInvokeData("dwmapi.h")]
public static extern HRESULT DwmUnregisterThumbnail(IntPtr hThumbnailId); public static extern HRESULT DwmUnregisterThumbnail(IntPtr hThumbnailId);
/// <summary>Updates the properties for a Desktop Window Manager (DWM) thumbnail.</summary> /// <summary>Updates the properties for a Desktop Window Manager (DWM) thumbnail.</summary>
/// <param name="hThumbnailId">The handle to the DWM thumbnail to be updated. Null or invalid thumbnails, as well as thumbnails owned by other processes will result in a return value of E_INVALIDARG.</param> /// <param name="hThumbnailId">
/// The handle to the DWM thumbnail to be updated. Null or invalid thumbnails, as well as thumbnails owned by other processes will result in a return
/// value of E_INVALIDARG.
/// </param>
/// <param name="ptnProperties">A pointer to a DWM_THUMBNAIL_PROPERTIES structure that contains the new thumbnail properties.</param> /// <param name="ptnProperties">A pointer to a DWM_THUMBNAIL_PROPERTIES structure that contains the new thumbnail properties.</param>
/// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns> /// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
[DllImport(Lib.DwmApi, ExactSpelling = true)] [DllImport(Lib.DwmApi, ExactSpelling = true)]
@ -440,28 +671,23 @@ namespace Vanara.PInvoke
[PInvokeData("dwmapi.h")] [PInvokeData("dwmapi.h")]
public struct DWM_BLURBEHIND public struct DWM_BLURBEHIND
{ {
/// <summary> /// <summary>A bitwise combination of DWM Blur Behind constant values that indicates which of the members of this structure have been set.</summary>
/// A bitwise combination of DWM Blur Behind constant values that indicates which of the members of this structure have been set.
/// </summary>
public DWM_BLURBEHIND_Mask dwFlags; public DWM_BLURBEHIND_Mask dwFlags;
/// <summary>
/// TRUE to register the window handle to DWM blur behind; FALSE to unregister the window handle from DWM blur behind. /// <summary>TRUE to register the window handle to DWM blur behind; FALSE to unregister the window handle from DWM blur behind.</summary>
/// </summary>
[MarshalAs(UnmanagedType.Bool)] [MarshalAs(UnmanagedType.Bool)]
public bool fEnable; public bool fEnable;
/// <summary> /// <summary>
/// The region within the client area where the blur behind will be applied. A NULL value will apply the blur behind the entire client area. /// The region within the client area where the blur behind will be applied. A NULL value will apply the blur behind the entire client area.
/// </summary> /// </summary>
public IntPtr hRgnBlur; public IntPtr hRgnBlur;
/// <summary>
/// TRUE if the window's colorization should transition to match the maximized windows; otherwise, FALSE. /// <summary>TRUE if the window's colorization should transition to match the maximized windows; otherwise, FALSE.</summary>
/// </summary>
[MarshalAs(UnmanagedType.Bool)] [MarshalAs(UnmanagedType.Bool)]
public bool fTransitionOnMaximized; public bool fTransitionOnMaximized;
/// <summary> /// <summary>Initializes a new instance of the <see cref="DWM_BLURBEHIND"/> struct.</summary>
/// Initializes a new instance of the <see cref="DWM_BLURBEHIND"/> struct.
/// </summary>
/// <param name="enabled">if set to <c>true</c> enabled.</param> /// <param name="enabled">if set to <c>true</c> enabled.</param>
public DWM_BLURBEHIND(bool enabled) public DWM_BLURBEHIND(bool enabled)
{ {
@ -471,20 +697,12 @@ namespace Vanara.PInvoke
dwFlags = DWM_BLURBEHIND_Mask.DWM_BB_ENABLE; dwFlags = DWM_BLURBEHIND_Mask.DWM_BB_ENABLE;
} }
/// <summary> /// <summary>Gets the region.</summary>
/// Gets the region. /// <value>The region.</value>
/// </summary>
/// <value>
/// The region.
/// </value>
public System.Drawing.Region Region => System.Drawing.Region.FromHrgn(hRgnBlur); public System.Drawing.Region Region => System.Drawing.Region.FromHrgn(hRgnBlur);
/// <summary> /// <summary>Gets or sets a value indicating whether the window's colorization should transition to match the maximized windows.</summary>
/// Gets or sets a value indicating whether the window's colorization should transition to match the maximized windows. /// <value><c>true</c> if the window's colorization should transition to match the maximized windows; otherwise, <c>false</c>.</value>
/// </summary>
/// <value>
/// <c>true</c> if the window's colorization should transition to match the maximized windows; otherwise, <c>false</c>.
/// </value>
public bool TransitionOnMaximized public bool TransitionOnMaximized
{ {
get => fTransitionOnMaximized; get => fTransitionOnMaximized;
@ -495,9 +713,7 @@ namespace Vanara.PInvoke
} }
} }
/// <summary> /// <summary>Sets the region.</summary>
/// Sets the region.
/// </summary>
/// <param name="graphics">The graphics.</param> /// <param name="graphics">The graphics.</param>
/// <param name="region">The region.</param> /// <param name="region">The region.</param>
public void SetRegion(System.Drawing.Graphics graphics, System.Drawing.Region region) public void SetRegion(System.Drawing.Graphics graphics, System.Drawing.Region region)
@ -514,16 +730,22 @@ namespace Vanara.PInvoke
{ {
/// <summary>The ARGB accent color.</summary> /// <summary>The ARGB accent color.</summary>
public uint clrColor; public uint clrColor;
/// <summary>The ARGB after glow color.</summary> /// <summary>The ARGB after glow color.</summary>
public uint clrAfterGlow; public uint clrAfterGlow;
/// <summary>Determines how much the glass streaks are visible in window borders.</summary> /// <summary>Determines how much the glass streaks are visible in window borders.</summary>
public uint nIntensity; public uint nIntensity;
/// <summary>Determines how bright the glass is (0 removes all color from borders).</summary> /// <summary>Determines how bright the glass is (0 removes all color from borders).</summary>
public uint clrAfterGlowBalance; public uint clrAfterGlowBalance;
/// <summary>Determines how bright the blur is.</summary> /// <summary>Determines how bright the blur is.</summary>
public uint clrBlurBalance; public uint clrBlurBalance;
/// <summary>Determines how much the glass reflection is visible.</summary> /// <summary>Determines how much the glass reflection is visible.</summary>
public uint clrGlassReflectionIntensity; public uint clrGlassReflectionIntensity;
/// <summary>Determines if borders are opaque ( <c>true</c>) or transparent ( <c>false</c>).</summary> /// <summary>Determines if borders are opaque ( <c>true</c>) or transparent ( <c>false</c>).</summary>
[MarshalAs(UnmanagedType.Bool)] [MarshalAs(UnmanagedType.Bool)]
public bool fOpaque; public bool fOpaque;
@ -535,14 +757,19 @@ namespace Vanara.PInvoke
{ {
/// <summary>A bitwise combination of DWM thumbnail constant values that indicates which members of this structure are set.</summary> /// <summary>A bitwise combination of DWM thumbnail constant values that indicates which members of this structure are set.</summary>
public DWM_TNP dwFlags; public DWM_TNP dwFlags;
/// <summary>The area in the destination window where the thumbnail will be rendered.</summary> /// <summary>The area in the destination window where the thumbnail will be rendered.</summary>
public RECT rcDestination; public RECT rcDestination;
/// <summary>The region of the source window to use as the thumbnail. By default, the entire window is used as the thumbnail.</summary> /// <summary>The region of the source window to use as the thumbnail. By default, the entire window is used as the thumbnail.</summary>
public RECT rcSource; public RECT rcSource;
/// <summary>The opacity with which to render the thumbnail. 0 is fully transparent while 255 is fully opaque. The default value is 255.</summary> /// <summary>The opacity with which to render the thumbnail. 0 is fully transparent while 255 is fully opaque. The default value is 255.</summary>
public byte opacity; public byte opacity;
/// <summary>TRUE to make the thumbnail visible; otherwise, FALSE. The default is FALSE.</summary> /// <summary>TRUE to make the thumbnail visible; otherwise, FALSE. The default is FALSE.</summary>
[MarshalAs(UnmanagedType.Bool)] public bool fVisible; [MarshalAs(UnmanagedType.Bool)] public bool fVisible;
/// <summary>TRUE to use only the thumbnail source's client area; otherwise, FALSE. The default is FALSE.</summary> /// <summary>TRUE to use only the thumbnail source's client area; otherwise, FALSE. The default is FALSE.</summary>
[MarshalAs(UnmanagedType.Bool)] public bool fSourceClientAreaOnly; [MarshalAs(UnmanagedType.Bool)] public bool fSourceClientAreaOnly;
} }
@ -554,82 +781,123 @@ namespace Vanara.PInvoke
{ {
/// <summary>The size of this DWM_TIMING_INFO structure.</summary> /// <summary>The size of this DWM_TIMING_INFO structure.</summary>
public int cbSize; public int cbSize;
/// <summary>The monitor refresh rate.</summary> /// <summary>The monitor refresh rate.</summary>
public UNSIGNED_RATIO rateRefresh; public UNSIGNED_RATIO rateRefresh;
/// <summary>The monitor refresh period.</summary> /// <summary>The monitor refresh period.</summary>
public ulong qpcRefreshPeriod; public ulong qpcRefreshPeriod;
/// <summary>The composition rate.</summary> /// <summary>The composition rate.</summary>
public UNSIGNED_RATIO rateCompose; public UNSIGNED_RATIO rateCompose;
/// <summary>The query performance counter value before the vertical blank.</summary> /// <summary>The query performance counter value before the vertical blank.</summary>
public ulong qpcVBlank; public ulong qpcVBlank;
/// <summary>The DWM refresh counter.</summary> /// <summary>The DWM refresh counter.</summary>
public ulong cRefresh; public ulong cRefresh;
/// <summary>The DirectX refresh counter.</summary> /// <summary>The DirectX refresh counter.</summary>
public uint cDXRefresh; public uint cDXRefresh;
/// <summary>The query performance counter value for a frame composition.</summary> /// <summary>The query performance counter value for a frame composition.</summary>
public ulong qpcCompose; public ulong qpcCompose;
/// <summary>The frame number that was composed at qpcCompose.</summary> /// <summary>The frame number that was composed at qpcCompose.</summary>
public ulong cFrame; public ulong cFrame;
/// <summary>The DirectX present number used to identify rendering frames.</summary> /// <summary>The DirectX present number used to identify rendering frames.</summary>
public uint cDXPresent; public uint cDXPresent;
/// <summary>The refresh count of the frame that was composed at qpcCompose.</summary> /// <summary>The refresh count of the frame that was composed at qpcCompose.</summary>
public ulong cRefreshFrame; public ulong cRefreshFrame;
/// <summary>The DWM frame number that was last submitted.</summary> /// <summary>The DWM frame number that was last submitted.</summary>
public ulong cFrameSubmitted; public ulong cFrameSubmitted;
/// <summary>The DirectX present number that was last submitted.</summary> /// <summary>The DirectX present number that was last submitted.</summary>
public uint cDXPresentSubmitted; public uint cDXPresentSubmitted;
/// <summary>The DWM frame number that was last confirmed as presented.</summary> /// <summary>The DWM frame number that was last confirmed as presented.</summary>
public ulong cFrameConfirmed; public ulong cFrameConfirmed;
/// <summary>The DirectX present number that was last confirmed as presented.</summary> /// <summary>The DirectX present number that was last confirmed as presented.</summary>
public uint cDXPresentConfirmed; public uint cDXPresentConfirmed;
/// <summary>The target refresh count of the last frame confirmed as completed by the GPU.</summary> /// <summary>The target refresh count of the last frame confirmed as completed by the GPU.</summary>
public ulong cRefreshConfirmed; public ulong cRefreshConfirmed;
/// <summary>The DirectX refresh count when the frame was confirmed as presented.</summary> /// <summary>The DirectX refresh count when the frame was confirmed as presented.</summary>
public uint cDXRefreshConfirmed; public uint cDXRefreshConfirmed;
/// <summary>The number of frames the DWM presented late.</summary> /// <summary>The number of frames the DWM presented late.</summary>
public ulong cFramesLate; public ulong cFramesLate;
/// <summary>The number of composition frames that have been issued but have not been confirmed as completed.</summary> /// <summary>The number of composition frames that have been issued but have not been confirmed as completed.</summary>
public uint cFramesOutstanding; public uint cFramesOutstanding;
/// <summary>The last frame displayed.</summary> /// <summary>The last frame displayed.</summary>
public ulong cFrameDisplayed; public ulong cFrameDisplayed;
/// <summary>The QPC time of the composition pass when the frame was displayed.</summary> /// <summary>The QPC time of the composition pass when the frame was displayed.</summary>
public ulong qpcFrameDisplayed; public ulong qpcFrameDisplayed;
/// <summary>The vertical refresh count when the frame should have become visible.</summary> /// <summary>The vertical refresh count when the frame should have become visible.</summary>
public ulong cRefreshFrameDisplayed; public ulong cRefreshFrameDisplayed;
/// <summary>The ID of the last frame marked as completed.</summary> /// <summary>The ID of the last frame marked as completed.</summary>
public ulong cFrameComplete; public ulong cFrameComplete;
/// <summary>The QPC time when the last frame was marked as completed.</summary> /// <summary>The QPC time when the last frame was marked as completed.</summary>
public ulong qpcFrameComplete; public ulong qpcFrameComplete;
/// <summary>The ID of the last frame marked as pending.</summary> /// <summary>The ID of the last frame marked as pending.</summary>
public ulong cFramePending; public ulong cFramePending;
/// <summary>The QPC time when the last frame was marked as pending.</summary> /// <summary>The QPC time when the last frame was marked as pending.</summary>
public ulong qpcFramePending; public ulong qpcFramePending;
/// <summary>The number of unique frames displayed. This value is valid only after a second call to the DwmGetCompositionTimingInfo function.</summary> /// <summary>The number of unique frames displayed. This value is valid only after a second call to the DwmGetCompositionTimingInfo function.</summary>
public ulong cFramesDisplayed; public ulong cFramesDisplayed;
/// <summary>The number of new completed frames that have been received.</summary> /// <summary>The number of new completed frames that have been received.</summary>
public ulong cFramesComplete; public ulong cFramesComplete;
/// <summary>The number of new frames submitted to DirectX but not yet completed.</summary> /// <summary>The number of new frames submitted to DirectX but not yet completed.</summary>
public ulong cFramesPending; public ulong cFramesPending;
/// <summary>The number of frames available but not displayed, used, or dropped. This value is valid only after a second call to DwmGetCompositionTimingInfo.</summary> /// <summary>The number of frames available but not displayed, used, or dropped. This value is valid only after a second call to DwmGetCompositionTimingInfo.</summary>
public ulong cFramesAvailable; public ulong cFramesAvailable;
/// <summary>The number of rendered frames that were never displayed because composition occurred too late. This value is valid only after a second call to DwmGetCompositionTimingInfo.</summary>
/// <summary>
/// The number of rendered frames that were never displayed because composition occurred too late. This value is valid only after a second call to DwmGetCompositionTimingInfo.
/// </summary>
public ulong cFramesDropped; public ulong cFramesDropped;
/// <summary>The number of times an old frame was composed when a new frame should have been used but was not available.</summary> /// <summary>The number of times an old frame was composed when a new frame should have been used but was not available.</summary>
public ulong cFramesMissed; public ulong cFramesMissed;
/// <summary>The frame count at which the next frame is scheduled to be displayed.</summary> /// <summary>The frame count at which the next frame is scheduled to be displayed.</summary>
public ulong cRefreshNextDisplayed; public ulong cRefreshNextDisplayed;
/// <summary>The frame count at which the next DirectX present is scheduled to be displayed.</summary> /// <summary>The frame count at which the next DirectX present is scheduled to be displayed.</summary>
public ulong cRefreshNextPresented; public ulong cRefreshNextPresented;
/// <summary>The total number of refreshes that have been displayed for the application since the DwmSetPresentParameters function was last called.</summary> /// <summary>The total number of refreshes that have been displayed for the application since the DwmSetPresentParameters function was last called.</summary>
public ulong cRefreshesDisplayed; public ulong cRefreshesDisplayed;
/// <summary>The total number of refreshes that have been presented by the application since DwmSetPresentParameters was last called.</summary> /// <summary>The total number of refreshes that have been presented by the application since DwmSetPresentParameters was last called.</summary>
public ulong cRefreshesPresented; public ulong cRefreshesPresented;
/// <summary>The refresh number when content for this window started to be displayed.</summary> /// <summary>The refresh number when content for this window started to be displayed.</summary>
public ulong cRefreshStarted; public ulong cRefreshStarted;
/// <summary>The total number of pixels DirectX redirected to the DWM.</summary> /// <summary>The total number of pixels DirectX redirected to the DWM.</summary>
public ulong cPixelsReceived; public ulong cPixelsReceived;
/// <summary>The number of pixels drawn.</summary> /// <summary>The number of pixels drawn.</summary>
public ulong cPixelsDrawn; public ulong cPixelsDrawn;
/// <summary>The number of empty buffers in the flip chain.</summary> /// <summary>The number of empty buffers in the flip chain.</summary>
public ulong cBuffersEmpty; public ulong cBuffersEmpty;
} }
@ -641,15 +909,19 @@ namespace Vanara.PInvoke
{ {
/// <summary>Width of the left border that retains its size.</summary> /// <summary>Width of the left border that retains its size.</summary>
public int cxLeftWidth; public int cxLeftWidth;
/// <summary>Width of the right border that retains its size.</summary> /// <summary>Width of the right border that retains its size.</summary>
public int cxRightWidth; public int cxRightWidth;
/// <summary>Height of the top border that retains its size.</summary> /// <summary>Height of the top border that retains its size.</summary>
public int cyTopHeight; public int cyTopHeight;
/// <summary>Height of the bottom border that retains its size.</summary> /// <summary>Height of the bottom border that retains its size.</summary>
public int cyBottomHeight; public int cyBottomHeight;
/// <summary>Retrieves a <see cref="MARGINS"/> instance with all values set to 0.</summary> /// <summary>Retrieves a <see cref="MARGINS"/> instance with all values set to 0.</summary>
public static readonly MARGINS Empty = new MARGINS(0); public static readonly MARGINS Empty = new MARGINS(0);
/// <summary>Retrieves a <see cref="MARGINS"/> instance with all values set to -1.</summary> /// <summary>Retrieves a <see cref="MARGINS"/> instance with all values set to -1.</summary>
public static readonly MARGINS Infinite = new MARGINS(-1); public static readonly MARGINS Infinite = new MARGINS(-1);
@ -736,6 +1008,7 @@ namespace Vanara.PInvoke
{ {
/// <summary>The ratio numerator.</summary> /// <summary>The ratio numerator.</summary>
public uint uiNumerator; public uint uiNumerator;
/// <summary>The ratio denominator.</summary> /// <summary>The ratio denominator.</summary>
public uint uiDenominator; public uint uiDenominator;
} }