Jump to content

How to blurred window with rounded corners?

Recommended Posts

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.


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

$hForm2 = GUICreate("MyGUI", 300, 370, -1, -1, $WS_POPUP)
GUICtrlSetBkColor(-1, 0x000000)
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()
        Case $msg = $GUI_EVENT_CLOSE
        Case $msg = $close

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
        Return 0

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

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

Edited by UE_morf_boon
Link to post
Share on other sites

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By ute_man
      Hi Forum,
      I wrote an Autoit script that automates downloading log files from a Data Logger. (GUI_1)
      This involves launching of third party software like WinSCP using my script.
      While downloading logs, I would like to blur the background (preferably blackout the background) leaving only GUI_1 visible so that users will only see the messages coming from my script and therefore user mistakes will be minimised.
      I can blur the background by creating another GUI (GUI_2) and using _GDIPlus.
      However, as I use WinWaitActive and WinActivate functions, there is no way for me to run my script behind GUI_2 as my script needs windows to be active for clicking on relevant buttons and other controls by moving mouse to specific mouse co-ordinates.
      Is there a way for me to achieve this.
      What I want is to run my script showing only GUI_1 and hiding everything else on the desktop bu masking with GUI_2.
      To make it more clear, I have a bottom layer on the desktop where the real mouse moving and clicking is taking place and middle layer for GUI_2 and then GUI_1 as the top most layer.
      Thank you guys,
      Any help is appreciated.
    • By GtaSpider
      Hey everyone,
      When I try to add blur to an Image with _GDIPlus_EffectCreateBlur and _GDIPlus_BitmapApplyEffect the blur is only horizontal, not horizontal and vertical, if the blur radius is <= 20. 
      Easy to test with the Image I attached and the default example from the helpfile of 
      _GDIPlus_BitmapApplyEffect The second Image I attached is the result and as you can see the cross is only blurred in one direction.  Does anyone have a clue why this happens and furthermore a solution for this problem? (I could just rotate the picture but then it would be twice as time consuming...)
      Thanks in advance,
      p.s.: Running Win 10 Pro with all updates

    • By Yashied
      This function allows you to blur the specified GDI+ bitmap with different force of blur (see screenshots, 1 - source image, 2 - blurring image with L=5, 3 - blurring image with L=10). The source bitmap may be of any color depth, the output bitmap is always 32 bits-per-pixel with alpha channel. The function creates a few parallel threads (up to 8), that significantly reduces the time consumption. It's worth noting that the blurring is performed for all channels, including the alpha channel.

      The following shows the basic algorithm for a simple blur of bitmap written in AutoIt. Unfortunately, it is not possible to solve using AutoIt because the processing of even a small picture may require too much time. For example, blurring image 100x100 can last a few seconds. To solve this problem, I compiled the time-consuming part of code (main loop) to machine code. This solved the problem of the time consumption but I wanted to get better results, especially for large images (more than 1000x1000) and large blur radius (10+). Then I divided the source image into several parts and started the blurring of each part in a separate thread. Now it's become quite good. See below for a complete example written for Autoit

      ; Scans the source bitmap pixel by pixel For $Yi = 0 To $H - 1 For $Xi = To $W - 1 $A = 0 $R = 0 $G = 0 $B = 0 $Count = 0 ; Calculates the average value for each color channel of source bitmap (including alpha chennel) For $Yj = $Yi - $L To $Yi + $L For $Xj = $Xi - $L To $Xi + $L If ($Xj >= 0) And ($Xj < $W) And ($Yj >= 0) And ($Yj < $H) Then $ARGB = DllStructCreate('BYTE B;BYTE G;BYTE R;BYTE A', $pBitsSrc + ($Xj + $Yj * $W) * 4) $A += $ARGB.A $R += $ARGB.R $G += $ARGB.G $B += $ARGB.B $Count += 1 EndIf Next Next ; Writes the calculated color to the corresponding pixel of destination bitmap $ARGB = DllStructCreate('BYTE B;BYTE G;BYTE R;BYTE A', $pBitsDst + ($Xj + $Yj * $W) * 4) $ARGB.A = $A / $Count $ARGB.R = $R / $Count $ARGB.G = $G / $Count $ARGB.B = $B / $Count Next Next

      #Include <GDIPlus.au3> If StringRegExpReplace(@AutoItVersion, '(?<!\d)(\d)(?!\d)', '0\1') < '' Then MsgBox(16, 'Error', 'Require AutoIt or later.') EndIf $sFile = @ScriptDir & '\Birds.png' _GDIPlus_Startup() $hBitmap = _GDIPlus_BitmapCreateFromFile($sFile) $hBlur = _GDIPlus_BitmapCreateBlurBitmap($hBitmap, 5, 1) _GDIPlus_ImageSaveToFile($hBlur, StringRegExpReplace($sFile, '(\.[^\.]+)', '_Blur\1')) _GDIPlus_BitmapDispose($hBlur) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() Func _GDIPlus_BitmapCreateBlurBitmap($hBitmap, $iRadius, $fAccurate = False) Local $tData[2], $hThread, $iThread, $tParams, $bProc, $tProc, $pProc, $aSize, $aHeight, $iLength, $hResult, $aResult $aSize = DllCall($__g_hGDIPDll, 'uint', 'GdipGetImageDimension', 'handle', $hBitmap, 'float*', 0, 'float*', 0) If (@Error) Or ($aSize[0]) Then Return 0 EndIf For $i = 2 To 3 If $iRadius > $aSize[$i] Then $iRadius = $aSize[$i] EndIf Next If $iRadius < 1 Then Return 0 EndIf $hResult = _GDIPlus_BitmapCreateFromScan0($aSize[2], $aSize[3], $GDIP_PXF32ARGB) $tData[0] = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $aSize[2], $aSize[3], $GDIP_ILMREAD, $GDIP_PXF32ARGB) $tData[1] = _GDIPlus_BitmapLockBits($hResult, 0, 0, $aSize[2], $aSize[3], $GDIP_ILMWRITE, $GDIP_PXF32ARGB) If @AutoItX64 Then $bProc = Binary('0x48894C24085541574156415548C7C00A0000004883EC0848C704240000000048FFC875EF4883EC28488BAC24A000000048837D000074054831C0EB0748C7C0010000004821C00F855E010000488BAC24A000000048837D080074054831C0EB0748C7C0010000004821C00F8527010000488BAC24A0000000837D180074054831C0EB0748C7C0010000004821C00F85F1000000488BAC24A0000000837D1C0074054831C0EB0748C7C0010000004821C00F85BB000000488BAC24A0000000837D200074054831C0EB0748C7C0010000004821C00F8585000000488BAC24A0000000837D240074054831C0EB0748C7C0010000004821C07553488BAC24A0000000837D280074054831C0EB0748C7C0010000004821C07521488BAC24A0000000837D2C0074054831C0EB0748C7C0010000004821C07502EB0948C7C001000000EB034831C04821C07502EB0948C7C001000000EB034831C04821C07502EB0948C7C001000000EB034831C04821C07502EB0948C7C001000000EB034831C04821C07502EB0948C7C001000000EB034831C04821C07502EB0948C7C001000000EB034831C04821C07502EB0948C7C001000000EB034831C04821C0740B4831C04863C0E946030000488BAC24A00000004863451450584889442428488BAC24A00000004C637D14488BAC24A00000004863451C4901C749FFCF4C3B7C24280F8CFB020000488BAC24A00000004863451050584889442430488BAC24A00000004C637D10488BAC24A0000000486345184901C749FFCF4C3B7C24300F8CB402000048C74424380000000048C74424400000000048C74424480000000048C74424500000000048C7442458000000004C8B7C2428488BAC24A0000000486345284929C74C897C24604C8B7C24604C8B742428488BAC24A0000000486345284901C64D39F70F8F840100004C8B7C2430488BAC24A0000000486345284929C74C897C24684C8B7C24684C8B742430488BAC24A0000000486345284901C64D39F70F8F2B0100004C8B7C24684D21FF7C614C8B7C2468488BAC24A0000000486345204939C77D3A4C8B7C24604D21FF7C1F4C8B7C2460488BAC24A0000000486345244939C77D0948C7C001000000EB034831C04821C0740948C7C001000000EB034831C04821C0740948C7C001000000EB034831C04821C00F8496000000488BAC24A00000004C8B7D004C8B7424684C8B6C2460488BAC24A0000000486345204C0FAFE84D01EE49C1E6024D01F74C897C24704C8B7C2438488B6C2470480FB645034901C74C897C24384C8B7C2440488B6C2470480FB645024901C74C897C24404C8B7C2448488B6C2470480FB645014901C74C897C24484C8B7C2450488B6C2470480FB645004901C74C897C245048FF4424584C8B7C2468488BAC24A00000004863452C4901C74C897C2468E9B3FEFFFF4C8B7C2460488BAC24A00000004863452C4901C74C897C2460E95AFEFFFF488BAC24A00000004C8B7D084C8B7424304C8B6C2428488BAC24A0000000486345204C0FAFE84D01EE49C1E6024D01F74C897C24704C8B7C2438FF7424584C89F859489948F7F94989C74C89F850488B6C2478588845034C8B7C2440FF7424584C89F859489948F7F94989C74C89F850488B6C2478588845024C8B7C2448FF7424584C89F859489948F7F94989C74C89F850488B6C2478588845014C8B7C2450FF7424584C89F859489948F7F94989C74C89F850488B6C24785888450048FF4424300F8123FDFFFF48FF4424280F81DCFCFFFF48C7C0010000004863C0EB034831C04883C478415D415E415F5DC3') Else $bProc = Binary('0x55535756BA0A00000083EC04C70424000000004A75F38B6C243C837D0000740431C0EB05B80100000021C00F85090100008B6C243C837D0400740431C0EB05B80100000021C00F85DF0000008B6C243C837D1000740431C0EB05B80100000021C00F85B50000008B6C243C837D1400740431C0EB05B80100000021C00F858B0000008B6C243C837D1800740431C0EB05B80100000021C075658B6C243C837D1C00740431C0EB05B80100000021C0753F8B6C243C837D2000740431C0EB05B80100000021C075198B6C243C837D2400740431C0EB05B80100000021C07502EB07B801000000EB0231C021C07502EB07B801000000EB0231C021C07502EB07B801000000EB0231C021C07502EB07B801000000EB0231C021C07502EB07B801000000EB0231C021C07502EB07B801000000EB0231C021C07502EB07B801000000EB0231C021C0740731C0E9400200008B6C243C8B450C8904248B6C243C8B5D0C8B6C243C035D144B3B1C240F8C150200008B6C243C8B4508894424048B6C243C8B5D088B6C243C035D104B3B5C24040F8CE8010000C744240800000000C744240C00000000C744241000000000C744241400000000C7442418000000008B1C248B6C243C2B5D20895C241C8B5C241C8B3C248B6C243C037D2039FB0F8F0D0100008B5C24048B6C243C2B5D20895C24208B5C24208B7C24048B6C243C037D2039FB0F8FD30000008B5C242021DB7C438B5C24208B6C243C3B5D187D298B5C241C21DB7C148B5C241C8B6C243C3B5D1C7D07B801000000EB0231C021C07407B801000000EB0231C021C07407B801000000EB0231C021C0746E8B6C243C8B5D008B7C24208B74241C8B6C243C0FAF751801F7C1E70201FB895C24248B5C24088B6C24240FB6450301C3895C24088B5C240C8B6C24240FB6450201C3895C240C8B5C24108B6C24240FB6450101C3895C24108B5C24148B6C24240FB6450001C3895C2414FF4424188B5C24208B6C243C035D24895C2420E916FFFFFF8B5C241C8B6C243C035D24895C241CE9DDFEFFFF8B6C243C8B5D048B7C24048B34248B6C243C0FAF751801F7C1E70201FB895C24248B5C2408FF74241889D85999F7F989C3538B6C2428588845038B5C240CFF74241889D85999F7F989C3538B6C2428588845028B5C2410FF74241889D85999F7F989C3538B6C2428588845018B5C2414FF74241889D85999F7F989C3538B6C242858884500FF4424040F81FFFDFFFFFF04240F81D3FDFFFFB801000000EB0231C083C4285E5F5B5DC20400') EndIf $iLength = BinaryLen($bProc) $pProc = DllCall('kernel32.dll', 'ptr', 'VirtualAlloc', 'ptr', 0, 'ulong_ptr', $iLength, 'dword', 0x1000, 'dword', 0x0040) $tProc = DllStructCreate('byte[' & $iLength & ']', $pProc[0]) DllStructSetData($tProc, 1, $bProc) $iThread = 8 If $iThread > $aSize[3] Then $iThread = $aSize[3] EndIf Dim $aHeight[$iThread] Dim $tParams[$iThread] Dim $hThread[$iThread] If $iThread = 1 Then $aHeight[0] = $aSize[3] Else $aHeight[0] = Floor($aSize[3] / $iThread) $aHeight[$iThread - 1] = $aSize[3] - $aHeight[0] * ($iThread - 1) For $i = 1 To $iThread - 2 $aHeight[$i] = $aHeight[0] Next EndIf $iLength = 0 For $i = 0 To $iThread - 1 $tParams[$i] = DllStructCreate('ptr;ptr;uint;uint;uint;uint;uint;uint;uint;uint') DllStructSetData($tParams[$i], 1, $tData[0].Scan0) DllStructSetData($tParams[$i], 2, $tData[1].Scan0) DllStructSetData($tParams[$i], 3, 0) DllStructSetData($tParams[$i], 4, $iLength) DllStructSetData($tParams[$i], 5, $aSize[2]) DllStructSetData($tParams[$i], 6, $aHeight[$i]) DllStructSetData($tParams[$i], 7, $aSize[2]) DllStructSetData($tParams[$i], 8, $aSize[3]) DllStructSetData($tParams[$i], 9, $iRadius) If $fAccurate Then DllStructSetData($tParams[$i],10, 1) Else DllStructSetData($tParams[$i],10, 2) EndIf $iLength+= $aHeight[$i] $aResult = DllCall('kernel32.dll', 'handle', 'CreateThread', 'ptr', 0, 'dword_ptr', 0, 'ptr', $pProc[0], 'struct*', $tParams[$i], 'dword', 0, 'ptr', 0) If (Not @Error) And ($aResult[0]) Then $hThread[$i] = $aResult[0] Else $hThread[$i] = 0 EndIf Next While 1 $iLength = 0 For $i = 0 To $iThread - 1 If $hThread[$i] Then $aResult = DllCall('kernel32.dll', 'bool', 'GetExitCodeThread', 'handle', $hThread[$i], 'dword*', 0) If (@Error) Or (Not $aResult[0]) Or ($aResult[2] <> 259) Then DllCall('kernel32.dll', 'bool', 'CloseHandle', 'handle', $hThread[$i]) $hThread[$i] = 0 Else $iLength += 1 EndIf EndIf Next If Not $iLength Then ExitLoop EndIf WEnd $aResult = DllCall('kernel32.dll', 'int', 'VirtualFree', 'ptr', $pProc[0], 'ulong_ptr', 0, 'dword', 0x4000) If (@Error) Or (Not $aResult[0]) Then ; Nothing EndIf _GDIPlus_BitmapUnlockBits($hResult, $tData[1]) _GDIPlus_BitmapUnlockBits($hBitmap, $tData[0]) Return $hResult EndFunc ;==>_GDIPlus_BitmapCreateBlurBitmap
      Function + Example
      Previous downloads: 17

    • By Edano
      i searched the forum, but didn't find anything.
      has anyone an idea or ever done it with autoit ? simple image transforming, like sharpness, brightness, blurring etc. ?
      maybe, does gdiplus.dll feature that ?
      here is a tutorial on how to do it the hard (mathematical) way. http://lodev.org/cgtutor/filtering.html before i try that, i wanted to know if there is already an existing project or an idea or anyone has experiences.
    • By UEZ
      Actually, I do not work with WinXP but by chance I discovered an effect.

      This is experimentell only and not fully implemented!

      Aero must be disabled (will done by script) on Vista+ os!

      #include <gdiplus.au3> #include <guiconstantsex.au3> #include <windowsconstants.au3> Opt("MustDeclareVars", 1) Opt("GUIOnEventMode", 1) Global Const $hDwmApiDll = DllOpen("dwmapi.dll") Global $sChkAero = DllStructCreate("int;") DllCall($hDwmApiDll, "int", "DwmIsCompositionEnabled", "ptr", DllStructGetPtr($sChkAero)) Global $aero = DllStructGetData($sChkAero, 1) If $aero Then DllCall($hDwmApiDll, "int", "DwmEnableComposition", "uint", False) Global $dy If @OSBuild < 6000 Then Global $aTheme = _WinAPI_GetCurrentThemeName() If Not @error Then $dy = -54 Else $dy = -40 EndIf Else $dy = -47 EndIf _GDIPlus_Startup() Global Const $hFullScreen = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]") Global Const $aFullScreen = WinGetPos($hFullScreen) Global Const $fW = 4 Global Const $fH = 32 Global Const $iW = 640 Global Const $iH = 400 Global Const $hGUI = GUICreate("", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_OVERLAPPEDWINDOW + $WS_EX_TOPMOST) Global Const $idTitle = GUICtrlCreateLabel("Pseudo Aero Effect by UEZ", $fW + 16, $fh / 3, 150, 16) GUICtrlSetFont(-1, 9, 800, 0, "Arial", 4) GUICtrlSetBkColor(-1, -2) Global Const $idLabel = GUICtrlCreateLabel(@LF & @LF & @LF & @TAB & "Done by UEZ 2011", $fW, $fH, $iW - 2 * $fW - 2, $iH - $fH - $fW) GUICtrlSetFont(-1, 30, 400, 0, "Arial", 4) GUICtrlSetBkColor(-1, -2) Global Const $idLabel_Min = GUICtrlCreateLabel("[_]", $iW - 50, $fH / 3, $fh / 2, $fh / 2) GUICtrlSetBkColor(-1, -2) Global Const $idLabel_Close = GUICtrlCreateLabel("[X]", $iW - 30, $fH / 3, $fh / 2, $fh / 2) GUICtrlSetBkColor(-1, -2) WinSetTrans($hGUI, "", 0xFF) Global Const $hGUI_Hidden = GUICreate("", $iW, $iH, 0, 0, Default, $WS_EX_MDICHILD + $WS_EX_LAYERED, $hGUI) GUISetState(@SW_HIDE, $hGUI_Hidden) GUISetState(@SW_SHOW, $hGUI) _SetGuiRoundCorners($hGUI, 16, True, False, True, False) Global $hDev = _WinAPI_GetDC($hGUI) Global $hDC_Area = _WinAPI_CreateCompatibleDC($hDev) Global $hBitmap_Area = _WinAPI_CreateCompatibleBitmap($hDev, $aFullScreen[2], $aFullScreen[3]) Global Const $hDC_Zoom = _WinAPI_GetDC(0) Global Const $hGUI_ZoomDC = _WinAPI_GetDC($hGUI_Hidden) Global Const $memDC = _WinAPI_CreateCompatibleDC($hGUI_ZoomDC) Global Const $memBmp = _WinAPI_CreateCompatibleBitmap($hGUI_ZoomDC, $iW, $iH) _WinAPI_SelectObject($memDC, $memBmp) Global $aPos = WinGetPos($hGUI) _WinAPI_StretchBlt($hGUI_ZoomDC, 0, 0, $iW, $iH, $hDC_Zoom, $aPos[0], $aPos[1], $iW, $iH, $SRCCOPY) _WinAPI_BitBlt($memDC, 0, 0, $iW, $iH, $hGUI_ZoomDC, 0, $dy, 0x00CC0020) Global Const $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) Global Const $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic) Global Const $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) Global Const $GW_CHILD = 5 Global Const $GW_HWNDNEXT = 2 Global $hRegion = _GDIPlus_RegionCreateFromRect(_GDIPlus_RectFCreate(0, 0, $iW, $iH)) Global $hChild = _WinAPI_GetWindow($hGUI, $GW_CHILD) Global $aRect, $msg Do $aRect = ControlGetPos($hChild, "", 0) _GDIPlus_RegionCombineRect($hRegion, _GDIPlus_RectFCreate($aRect[0], $aRect[1], $aRect[2], $aRect[3]), 3) $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT) Until Not $hChild _GDIPlus_GraphicsSetClipRegion($hGraphic, $hRegion) _GDIPlus_RegionDispose($hRegion) Global $tRectF = _GDIPlus_RectFCreate(0, 0, $iW / 1.5, $iH / 1.5) Global $hBrush = _GDIPlus_LineBrushCreateFromRectWithAngle($tRectF, 0x80201010, 0xA0F0F0F0, -60, False, 1) Global $hBmp = _GDIPlus_BitmapCreateFromHBITMAP($memBmp) Global $hBmp_Blur = _Blur($hBmp, $iW, $iH) _GDIPlus_GraphicsDrawImage($hContext, $hBmp_Blur, 0, 0) _GDIPlus_GraphicsFillRect($hContext, 0, 0, $iW, $iH, $hBrush) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iW, $iH) _GDIPlus_BitmapDispose($hBmp) _GDIPlus_BitmapDispose($hBmp_Blur) GUIRegisterMsg($WM_WINDOWPOSCHANGED, "WM_WINDOWPOSCHANGED") GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") Global $exit = False GUISetOnEvent($GUI_EVENT_RESTORE, "Restored", $hGUI) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $hGUI) GUICtrlSetOnEvent($idLabel_Close, "_Exit") GUICtrlSetOnEvent($idLabel_Min, "_MinWin") While Sleep(30) ;~ Repaint() If $exit Then ExitLoop WEnd GUIRegisterMsg($WM_WINDOWPOSCHANGED, "") _WinAPI_DeleteDC($memDC) _WinAPI_DeleteObject($memBmp) _WinAPI_DeleteObject($hBitmap_Area) _WinAPI_ReleaseDC($hGUI, $hDev) _WinAPI_ReleaseDC($hGUI, $hGUI_ZoomDC) _WinAPI_ReleaseDC(0, $hDC_Zoom) _GDIPlus_BrushDispose($hBrush) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() GUIDelete() $tRectF = 0 If $aero Then DllCall($hDwmApiDll, "int", "DwmEnableComposition", "uint", True) Exit Func _Exit() $exit = True EndFunc Func _MinWin() GUISetState(@SW_MINIMIZE, $hGUI) EndFunc Func Restored() Repaint() EndFunc Func WM_WINDOWPOSCHANGED($hWnd, $iMsg, $StartWIndowPosaram, $lParam) Repaint() Return "GUI_RUNDEFMSG" EndFunc Func Repaint() $aPos = WinGetPos($hGUI) _WinAPI_StretchBlt($hGUI_ZoomDC, 0, 0, $iW, $iH, $hDC_Zoom, $aPos[0]+16, $aPos[1] + 3, $iW, $iH, $SRCCOPY) _WinAPI_BitBlt($memDC, 0, 0, $iW, $iH, $hGUI_ZoomDC, 0, $dy, 0x00CC0020) DllStructSetData($tRectF, "X", $aPos[0]) DllStructSetData($tRectF, "Y", $aPos[1]) $hBrush = _GDIPlus_LineBrushCreateFromRectWithAngle($tRectF, 0x80302020, 0xA0F0F0F0, -60, False, 1) $hBmp = _GDIPlus_BitmapCreateFromHBITMAP($memBmp) $hBmp_Blur = _Blur($hBmp, $iW, $iH) _GDIPlus_GraphicsDrawImage($hContext, $hBmp_Blur, 0, 0) _GDIPlus_GraphicsFillRect($hContext, 0, 0, $iW, $iH, $hBrush) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iW, $iH) _GDIPlus_BitmapDispose($hBmp) _GDIPlus_BitmapDispose($hBmp_Blur) _GDIPlus_BrushDispose($hBrush) EndFunc Func WM_NCHITTEST($hWndGUI, $MsgID, $WParam, $LParam) If ($hWndGUI = $hGui) And ($MsgID = $WM_NCHITTEST) Then Return $HTCAPTION EndFunc ;==>WM_NCHITTEST Func _Blur($hBitmap, $iW, $iH, $fScale = 0.30, $qual = 6); by eukalyptus Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND(_WinAPI_GetDesktopWindow()) Local $hBmpSmall = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics) Local $hGfxSmall = _GDIPlus_ImageGetGraphicsContext($hBmpSmall) DllCall($ghGDIPDll, "uint", "GdipSetPixelOffsetMode", "hwnd", $hGfxSmall, "int", 2) Local $hBmpBig = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics) Local $hGfxBig = _GDIPlus_ImageGetGraphicsContext($hBmpBig) DllCall($ghGDIPDll, "uint", "GdipSetPixelOffsetMode", "hwnd", $hGfxBig, "int", 2) _GDIPlus_GraphicsScaleTransform($hGfxSmall, $fScale, $fScale) _GDIPlus_GraphicsSetInterpolationMode($hGfxSmall, $qual) _GDIPlus_GraphicsScaleTransform($hGfxBig, 1 / $fScale, 1 / $fScale) _GDIPlus_GraphicsSetInterpolationMode($hGfxBig, $qual) _GDIPlus_GraphicsDrawImageRect($hGfxSmall, $hBitmap, 0, 0, $iW, $iH) _GDIPlus_GraphicsDrawImageRect($hGfxBig, $hBmpSmall, 0, 0, $iW, $iH) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($hBmpSmall) _GDIPlus_GraphicsDispose($hGfxSmall) _GDIPlus_GraphicsDispose($hGfxBig) Return $hBmpBig EndFunc ;==>_Blur Func _WinAPI_StretchBlt($hDestDC, $iXDest, $iYDest, $iWidthDest, $iHeightDest, $hSrcDC, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $iRop) Local $Ret = DllCall("gdi32.dll", "int", "StretchBlt", "hwnd", $hDestDC, "int", $iXDest, "int", $iYDest, "int", $iWidthDest, "int", $iHeightDest, "hwnd", $hSrcDC, "int", $iXSrc, "int", $iYSrc, "int", $iWidthSrc, "int", $iHeightSrc, "dword", $iRop) If (@error) Or (Not $Ret[0]) Then Return SetError(1, 0, 0) Return 1 EndFunc ;==>_WinAPI_StretchBlt ; #FUNCTION# ==================================================================================================================== ; Name...........: _WinAPI_GetCurrentThemeName ; Description....: Retrieves the name of the current visual styles, color scheme name, and size name. ; Syntax.........: _WinAPI_GetCurrentThemeName ( ) ; Parameters.....: None ; Return values..: Success - The array that contains the following information: ; ; [0] - The theme path and file name. ; [1] - The color scheme name. ; [2] - The size name. ; ; Failure - 0 and sets the @error flag to non-zero, @extended flag may contain the system error code. ; Author.........: Yashied ; Modified.......: ; Remarks........: None ; Related........: ; Link...........: @@MsdnLink@@ GetCurrentThemeName ; Example........: Yes ; =============================================================================================================================== Func _WinAPI_GetCurrentThemeName() Local $Ret = DllCall('uxtheme.dll', 'uint', 'GetCurrentThemeName', 'wstr', '', 'int', 4096, 'wstr', '', 'int', 2048, 'wstr', '', 'int', 2048) If @error Then Return SetError(1, 0, 0) Else If $Ret[0] Then Return SetError(1, $Ret[0], 0) EndIf EndIf Local $Result[3] For $i = 0 To 2 $Result[$i] = $Ret[$i * 2 + 1] Next Return $Result EndFunc ;==>_WinAPI_GetCurrentThemeName Func _SetGuiRoundCorners($hGUI, $iEllipse, $iLeftUp = True, $iLeftDown = True, $iRightUp = True, $iRightDown = True) Local $hCornerRgn Local $aGuiSize = WinGetPos($hGUI) Local $hRgn = _WinAPI_CreateRoundRectRgn(0, 0, $aGuiSize[2], $aGuiSize[3], $iEllipse, $iEllipse) If $iLeftUp = False Then $hCornerRgn = _WinAPI_CreateRectRgn(0, 0, $aGuiSize[2] / 2, $aGuiSize[3] / 2) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR) _WinAPI_DeleteObject($hCornerRgn) EndIf If $iLeftDown = False Then $hCornerRgn = _WinAPI_CreateRectRgn(0, $aGuiSize[3] / 2, $aGuiSize[2] / 2, $aGuiSize[3]) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR) _WinAPI_DeleteObject($hCornerRgn) EndIf If $iRightUp = False Then $hCornerRgn = _WinAPI_CreateRectRgn($aGuiSize[2] / 2, 0, $aGuiSize[2], $aGuiSize[3] / 2) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR) _WinAPI_DeleteObject($hCornerRgn) EndIf If $iRightDown = False Then $hCornerRgn = _WinAPI_CreateRectRgn($aGuiSize[2] / 2, $aGuiSize[3] / 2, $aGuiSize[2] - 1, $aGuiSize[3] - 1) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR) _WinAPI_DeleteObject($hCornerRgn) EndIf _WinAPI_SetWindowRgn($hGUI, $hRgn) EndFunc ;==>_SetGuiRoundCorners #region additional GDI+ functions Func _GDIPlus_GraphicsScaleTransform($hGraphics, $nScaleX, $nScaleY, $iOrder = 0) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipScaleWorldTransform", "hwnd", $hGraphics, "float", $nScaleX, "float", $nScaleY, "int", $iOrder) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] = 0 EndFunc ;==>_GDIPlus_GraphicsScaleTransform Func _GDIPlus_GraphicsSetInterpolationMode($hGraphics, $iInterpolationMode) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "hwnd", $hGraphics, "int", $iInterpolationMode) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] = 0 EndFunc ;==>_GDIPlus_GraphicsSetInterpolationMode Func _GDIPlus_LineBrushCreateFromRectWithAngle($tRectF, $iARGBClr1, $iARGBClr2, $nAngle, $fIsAngleScalable = True, $iWrapMode = 0) Local $pRectF, $aResult $pRectF = DllStructGetPtr($tRectF) $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateLineBrushFromRectWithAngle", "ptr", $pRectF, "uint", $iARGBClr1, "uint", $iARGBClr2, "float", $nAngle, "int", $fIsAngleScalable, "int", $iWrapMode, "int*", 0) If @error Then Return SetError(@error, @extended, 0) Return $aResult[7] EndFunc ;==>_GDIPlus_LineBrushCreateFromRectWithAngle Func _GDIPlus_GraphicsSetClipRegion($hGraphics, $hRegion, $iCombineMode = 0) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetClipRegion", "hwnd", $hGraphics, "hwnd", $hRegion, "int", $iCombineMode) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] = 0 EndFunc Func _GDIPlus_RegionCreateFromRect($tRectF) Local $pRectF, $aResult $pRectF = DllStructGetPtr($tRectF) $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateRegionRect", "ptr", $pRectF, "int*", 0) If @error Then Return SetError(@error, @extended, 0) Return $aResult[2] EndFunc Func _GDIPlus_RegionCombineRect($hRegion, $tRectF, $iCombineMode = 2) Local $pRectF, $aResult $pRectF = DllStructGetPtr($tRectF) $aResult = DllCall($ghGDIPDll, "uint", "GdipCombineRegionRect", "hwnd", $hRegion, "ptr", $pRectF, "int", $iCombineMode) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] = 0 EndFunc Func _GDIPlus_RegionDispose($hRegion) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDeleteRegion", "hwnd", $hRegion) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] = 0 EndFunc #endregion
      If you have the classic theme activate adjust -52 to -38 in _WinAPI_BitBlt($memDC, 0, 0, $iW, $iH, $hGUI_ZoomDC, 0, -52, 0x00CC0020) lines!

      Btw, how can I check whether classical or Luna theme is activated?

      only updates when window is moved no transparent labels relatively slow Screenshot, short AVI video and optimized version by eukalyptus here: AutoIt.de

      Maybe this effect comes 4 years too late...

  • Create New...