WildByDesign Posted Monday at 10:00 PM Posted Monday at 10:00 PM (edited) There are some great examples for adding Blur to the GUI throughout the forum. However, the types of blur that are covered in those examples are a bit outdated: ;ACCENT_STATE Global Const $ACCENT_DISABLED = 0 Global Const $ACCENT_ENABLE_GRADIENT = 1 Global Const $ACCENT_ENABLE_TRANSPARENTGRADIENT = 2 Global Const $ACCENT_ENABLE_BLURBEHIND = 3 Global Const $ACCENT_INVALID_STATE = 4 Since that time, those options have expanded more to the following: ACCENT_DISABLED = 0 ACCENT_ENABLE_GRADIENT = 1 ACCENT_ENABLE_TRANSPARENTGRADIENT = 2 ACCENT_ENABLE_BLURBEHIND = 3 ACCENT_ENABLE_ACRYLICBLURBEHIND = 4 ACCENT_ENABLE_HOSTBACKDROP = 5 ACCENT_INVALID_STATE = 6 I am particularly curious about ACCENT_ENABLE_HOSTBACKDROP but it does not come up in any searches on this forum. I will share an example GUI blur that is working (requires Windows 11): Spoiler expandcollapse popup#include <GUIConstantsEx.au3> #include <WinAPIGdi.au3> $hGUI = GUICreate("Example", 400, 400) GUISetBkColor(0x000000) GUISetState(@SW_SHOW) _WinAPI_DwmSetWindowAttribute__($hGUI, 20, 1) Local $hRgn = _WinAPI_CreateEllipticRgn(_WinAPI_CreateRectEx(0, 0, 0, 0)) _WinAPI_DwmEnableBlurBehindWindow($hGUI, 1, 0, $hRgn) If $hRgn Then _WinAPI_DeleteObject($hRgn) EndIf $tAccentPolicy = DllStructCreate("int AccentState; int AccentFlags; int GradientColor; int AnimationId") $tAttrData = DllStructCreate("dword Attribute; ptr DataBuffer; ulong Size") $tAccentPolicy.AccentState = 3 $tAttrData.Attribute = 19 ; WCA_ACCENT_POLICY $tAttrData.DataBuffer = DllStructGetPtr($tAccentPolicy) $tAttrData.Size = DllStructGetSize($tAccentPolicy) $aResult = DllCall("user32.dll", "bool", "SetWindowCompositionAttribute", "hwnd", $hGUI, "ptr", DllStructGetPtr($tAttrData)) _WinAPI_DwmExtendFrameIntoClientArea($hGUI, _WinAPI_CreateMargins(-1, -1, -1, -1)) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func _WinAPI_DwmSetWindowAttribute__($hwnd, $attribute = 34, $value = 0x00FF00, $valLen = 4) Local $aCall = DllCall('dwmapi.dll', 'long', 'DwmSetWindowAttribute', 'hwnd', $hWnd, 'dword', $attribute, 'dword*', $value, 'dword', $valLen) If @error Then Return SetError(@error, @extended, 0) If $aCall[0] Then Return SetError(10, $aCall[0], 0) Return 1 EndFunc ;==>_WinAPI_DwmSetWindowAttribute__ The problem that I have is that I am still very much a beginner here. I don't understand DllStruct at all. Thank you for your time and suggestions. I appreciate it very much. Edited Monday at 10:01 PM by WildByDesign
WildByDesign Posted Monday at 10:15 PM Author Posted Monday at 10:15 PM Another thing that I am interested in is having the blur blended with a color. None of the examples for that in the forum have worked or were complete. Parsix 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now