Jump to content

Recommended Posts

Posted

Some new interesting stuff to play with. Good to see MS bringing more options in Win11.

 
From DwmSetWindowAttribute on msdn updated earlier this month:

Quote

DWMWA_BORDER_MARGINS
Use with DwmSetWindowAttribute
. Specifies the override location of the window border, as a distance from each
edge. The pvAttribute parameter points to a value of type FRAME_MARGIN.

A value of all zeros disables the override set by this attribute, resulting in
default window borders. Otherwise, all values must be greater than or equal to 1.

Each value in the FRAME_MARGIN (left, right, top, bottom) indicates a distance
inwards from each edge of the window. Non-zero border margins forces the window
to have a border and sets the location of the border. Window contents covered
by or outside the border are clipped.

This value will be supported in an upcoming update to Windows 11 build 26100.

Quote

DWMWA_REDIRECTIONBITMAP_ALPHA
Use with
DwmSetWindowAttribute
. Enables or disables the use of the alpha channel in the window's redirection
bitmap. If this attribute is set to true, the window must contain premultiplied
alpha values in each pixel. If it is false, the alpha is ignored and the
redirection bitmap is treated as fully opaque. This attribute defaults to false.

This value is supported starting with Windows 11 Build 26100.

Posted (edited)

It looks like these were added to the documentation about 11 months ago on their GitHub repo. DWMWA_BORDER_MARGINS still suggests:

Quote

This value will be supported in an upcoming update to Windows 11 build 26100.

Yet I have no idea if they have put it in the latest 24H2/25H2 builds or not. Or Insider builds.

It mentions:

Quote

The pvAttribute parameter points to a value of type FRAME_MARGIN.

Does anyone know if this would mean the same thing as using _WinAPI_CreateMargins?

Here is extended _WinAPI_DwmSetWindowAttribute() function to allow the new values of 39 and 40.

Global Const $DWMWA_REDIRECTIONBITMAP_ALPHA = 39
Global Const $DWMWA_BORDER_MARGINS = 40

_WinAPI_DwmSetWindowAttributeEx($hGUI, $DWMWA_BORDER_MARGINS, _WinAPI_CreateMargins(4, 4, 4, 4))

Func _WinAPI_DwmSetWindowAttributeEx($hWnd, $iAttribute, $iData)
    Switch $iAttribute
        Case 2, 3, 4, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, $DWMWA_USE_IMMERSIVE_DARK_MODE, 33, 34, 35, 36, 37, 38, 39, 40

        Case Else
            Return SetError(1, 0, 0)
    EndSwitch

    Local $aCall = DllCall('dwmapi.dll', 'long', 'DwmSetWindowAttribute', 'hwnd', $hWnd, 'dword', $iAttribute, _
            'dword*', $iData, 'dword', 4)
    If @error Then Return SetError(@error + 10, @extended, 0)
    If $aCall[0] Then Return SetError(10, $aCall[0], 0)

    Return 1
EndFunc   ;==>_WinAPI_DwmSetWindowAttributeEx

 

Edited by WildByDesign

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...