Biatu Posted July 30, 2017 Share Posted July 30, 2017 (edited) I am attempting to create a translucent GUI with the blur effect, and I got everything but the rounding to work correctly. Anyone know how to get rid of the black corners? Thank you! This is what I have so far: expandcollapse popup#include <GUIConstants.au3> #include <WinAPI.au3> #include <WinAPIGdi.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> If _WinAPI_DwmIsCompositionEnabled() Then $iHasDWM=1 Local $iHeight=300 Local $iWidth=300 $hGUI = GUICreate("Windows 10 Blur", $iWidth, $iHeight,-1,-1,$WS_POPUP) GUISetBkColor(0x000000) GUISetState() If $iHasDWM Then Local $hRgn = _WinAPI_CreateRoundRectRgn(0,0,$iWidth+1,$iHeight+1,50,50) Local $hFormRgn=_WinAPI_CreateRectRgnIndirect(_WinAPI_GetClientRect($hGUI)) Local $hRgnTest=_WinAPI_CreateNullRgn() _WinAPI_CombineRgn($hRgnTest,$hRgn,$hFormRgn,$RGN_XOR) _WinAPI_DwmEnableBlurBehindWindow($hGUI,1,1,$hRgnTest) _WinAPI_DwmEnableBlurBehindWindow10($hGUI) EndIf While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WinAPI_DwmEnableBlurBehindWindow10 ; Description ...: Enables Aero-like blurred background in Windows 10. ; Syntax ........: _WinAPI_DwmEnableBlurBehindWindow10($hWnd[, $iMode = $ACCENT_ENABLE_BLURBEHIND]) ; Parameters ....: $hWnd - Window handle. ; $bEnable - [optional] Enable or disable the blur effect. ; Return values .: 1 on success, 0 otherwise. Call _WinAPI_GetLastError on failure for more information. ; Author ........: scintilla4evr ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: http://vhanla.codigobit.info/2015/07/enable-windows-10-aero-glass-aka-blur.html and http://undoc.airesoft.co.uk/user32.dll/SetWindowCompositionAttribute.php ; Example .......: Yes ; =============================================================================================================================== Func _WinAPI_DwmEnableBlurBehindWindow10($hWnd, $bEnable = True) Local $tAccentPolicy = DllStructCreate("int AccentState; int AccentFlags; int GradientColor; int AnimationId") Local $tAttrData = DllStructCreate("dword Attribute; ptr DataBuffer; ulong Size") $tAccentPolicy.AccentState = $bEnable ? 3 : 0 $tAttrData.Attribute = 19 ; WCA_ACCENT_POLICY $tAttrData.DataBuffer = DllStructGetPtr($tAccentPolicy) $tAttrData.Size = DllStructGetSize($tAccentPolicy) Local $aResult = DllCall("user32.dll", "bool", "SetWindowCompositionAttribute", "hwnd", $hWnd, "ptr", DllStructGetPtr($tAttrData)) If @error Then Return SetError(@error, @extended, 0) Return $aResult[0] EndFunc Edited July 30, 2017 by Biatu What is what? What is what. Link to comment Share on other sites More sharing options...
Bilgus Posted July 30, 2017 Share Posted July 30, 2017 (edited) @Biatu, Have you tried setting the window to the same rounded region, you probably have the window as a rectangular region and therefore the repaint isn't happening 'around' the window _WinAPI_SetWindowRgn ( $hGUI, $hRgn, True ) [most likely put prior to _WinAPI_CombineRgn($hRgnTest,$hRgn,$hFormRgn,$RGN_XOR)] {edit} if that doesn't work try forcing a repaint or changing the backcolor and see if it changes _WinAPI_RedrawWindow ($hGUI) ; Sorry, I don't have Win10 to test on Edited July 30, 2017 by Bilgus Link to comment Share on other sites More sharing options...
Biatu Posted July 30, 2017 Author Share Posted July 30, 2017 All options interfere with _WinAPI_DwmEnableBlurBehindWindow10($hGUI) and thus no blur What is what? What is what. Link to comment Share on other sites More sharing options...
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