Search the Community
Showing results for tags 'Glass Effect'.
-
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? Limitations: only updates when window is movedno transparent labelsrelatively slowScreenshot, short AVI video and optimized version by eukalyptus here: AutoIt.de Maybe this effect comes 4 years too late... Br, UEZ