Jump to content

Recommended Posts

Posted (edited)

Hey. I'm trying to add blur to a rounded window.

I'm using blur from this topic:


But it doesn't work with rounded corners. I think the problem is that the user32.dll library is called twice.

Code: 

#Include <GUIConstantsEx.au3>
#Include <WindowsConstants.au3>
#Include <WinAPI.au3>
#include "_WinAPI_DwmEnableBlurBehindWindow10.au3"

$hForm2 = GUICreate("MyGUI", 300, 370, -1, -1, $WS_POPUP)
;_WinAPI_DwmEnableBlurBehindWindow10($hForm2)
GUISetBkColor(0x000000)
GUICtrlSetBkColor(-1, 0x000000)
_Corners($hForm2,0,0,300,370,30,30)
GUICtrlCreateLabel('',0,0,400, 25,-1,$GUI_WS_EX_PARENTDRAG)
$close = GUICtrlCreateButton("exit",20,40,80,25)
GUIRegisterMsg($WM_MOVE, 'WM_MOVE')
GUISetState(@SW_SHOW, $hForm2)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $close
            Exit
    EndSelect
WEnd
Exit

Func _Corners($hWnd,$x1,$y1,$x2,$y2,$x3,$y3)
$pos = WinGetPos($hWnd)
$ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $x1, "long", $y1, "long", $x2, "long", $y2, "long",$x3, "long", $y3)
If $ret[0] Then
    $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $ret[0], "int", 1)
    If $ret2[0] Then
        Return 1
    Else
        Return 0
    EndIf
EndIf
EndFunc

Func WM_MOVE($hWnd, $iMsg, $wParam, $lParam)
    Switch $hWnd
        Case $hForm2
            Local $Pos = WinGetPos($hForm2)
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc

Please help me combine these two solutions or find an analogue.

Edited by UE_morf_boon
Posted

Also trying to figure this out. Can't get the 'DWMAPI' to apply a blur effect on Windows 10, and on the other hand, 'SetWindowCompositionAttribute' won't allow shapes or regions.

Can't wait to figure it out.

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...