Jump to content

A question about Win 7 GUI Aero Trasnpacey


Recommended Posts

I found this in the forum it's useful:

#include <GUIConstants.au3>

 $Struct = DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight;")
 $sStruct = DllStructCreate("dword;int;ptr;int")

 Global $MyArea[4] = [50, 50, 50, 50]


; #FUNCTION#;===============================================================================
;
; Name...........: _Vista_ApplyGlass
; Description ...: Applys glass effect to a window
; Syntax.........: _Vista_ApplyGlass($hWnd, [$bColor)
; Parameters ....: $hWnd - Window handle:
;               $bColor  - Background color
; Return values .: Success - No return
;               Failure - Returns 0
; Author ........: James Brooks
; Modified.......:
; Remarks .......: Thanks to weaponx!
; Related .......:
; Link ..........;
; Example .......; Yes
;
;;==========================================================================================
 Func _Vista_ApplyGlass($hWnd, $bColor = 0x000000)
    If @OSVersion <> "WIN_7" Then
        MsgBox(16, "_Vista_ApplyGlass", "You are not running Win 7!")
        Exit
    Else
        GUISetBkColor($bColor); Must be here!
        $Ret = DllCall("dwmapi.dll", "long", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "long*", DllStructGetPtr($Struct))
        If @error Then
            Return 0
            SetError(1)
        Else
            Return $Ret
        EndIf
    EndIf
 EndFunc ;==>_Vista_ApplyGlass

; #FUNCTION#;===============================================================================
;
; Name...........: _Vista_ApplyGlassArea
; Description ...: Applys glass effect to a window area
; Syntax.........: _Vista_ApplyGlassArea($hWnd, $Area, [$bColor)
; Parameters ....: $hWnd - Window handle:
;               $Area - Array containing area points
;               $bColor  - Background color
; Return values .: Success - No return
;               Failure - Returns 0
; Author ........: James Brooks
; Modified.......:
; Remarks .......: Thanks to monoceres!
; Related .......:
; Link ..........;
; Example .......; Yes
;
;;==========================================================================================
 Func _Vista_ApplyGlassArea($hWnd, $Area, $bColor = 0x000000)
    If @OSVersion <> "WIN_7" Then
        MsgBox(16, "_Vista_ApplyGlass", "You are not running win 7!")
        Exit
    Else
        If IsArray($Area) Then
            DllStructSetData($Struct, "cxLeftWidth", $Area[0])
            DllStructSetData($Struct, "cxRightWidth", $Area[1])
            DllStructSetData($Struct, "cyTopHeight", $Area[2])
            DllStructSetData($Struct, "cyBottomHeight", $Area[3])
            GUISetBkColor($bColor); Must be here!
            $Ret = DllCall("dwmapi.dll", "long*", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "ptr", DllStructGetPtr($Struct))
            If @error Then
                Return 0
            Else
                Return $Ret
            EndIf
        Else
            MsgBox(16, "_Vista_ApplyGlassArea", "Area specified is not an array!")
        EndIf
    EndIf
 EndFunc ;==>_Vista_ApplyGlassArea

; #FUNCTION#;===============================================================================
;
; Name...........: _Vista_EnableBlurBehind
; Description ...: Enables the blur effect on the provided window handle.
; Syntax.........: _Vista_EnableBlurBehind($hWnd)
; Parameters ....: $hWnd - Window handle:
; Return values .: Success - No return
;               Failure - Returns 0
; Author ........: James Brooks
; Modified.......:
; Remarks .......: Thanks to komalo
; Related .......:
; Link ..........;
; Example .......; Yes
;
;;==========================================================================================
 Func _Vista_EnableBlurBehind($hWnd, $bColor = 0x000000)
    If @OSVersion <> "WIN_7" Then
        MsgBox(16, "_Vista_ApplyGlass", "You are not runningwin 7!")
        Exit
    Else
        Const $DWM_BB_ENABLE = 0x00000001

        DllStructSetData($sStruct, 1, $DWM_BB_ENABLE)
        DllStructSetData($sStruct, 2, "1")
        DllStructSetData($sStruct, 4, "1")

        GUISetBkColor($bColor); Must be here!
        $Ret = DllCall("dwmapi.dll", "int", "DwmEnableBlurBehindWindow", "hwnd", $hWnd, "ptr", DllStructGetPtr($sStruct))
        If @error Then
            Return 0
        Else
            Return $Ret
        EndIf
    EndIf
 EndFunc ;==>_Vista_EnableBlurBehind

; #FUNCTION#;===============================================================================
;
; Name...........: _Vista_ICE
; Description ...: Returns 1 if DWM is enabled or 0 if not
; Syntax.........: _Vista_ICE()
; Parameters ....:
; Return values .: Success - Returns 1
;               Failure - Returns 0
; Author ........: James Brooks
; Modified.......:
; Remarks .......: Thanks to BrettF
; Related .......:
; Link ..........;
; Example .......; Yes
;
;;==========================================================================================
 Func _Vista_ICE()
    $ICEStruct = DllStructCreate("int;")
    $Ret = DllCall("dwmapi.dll", "int", "DwmIsCompositionEnabled", "ptr", DllStructGetPtr($ICEStruct))
    If @error Then
        Return 0
    Else
        Return DllStructGetData($ICEStruct, 1)
    EndIf
 EndFunc ;==>_Vista_ICE

but how to use it to create a GUI such this one in the photo?? the controls with a black color disappears after applying the Aero Trasnspacey and that's clear.. so how to make black labels??

post-60364-0-11058500-1300125222_thumb.p

Edited by SYRAU3
Link to comment
Share on other sites

  • 3 months later...

@powerofos

What does that have to do with this topic? Sounds like all you want is GUICtrlCreatePic()

@AdmiralManHairAlkex,

I feel my question is relative to this topic.

As i know, GUICtrlCreatePic can't do this effect, have you seen the attachment?

Kim.Y

Link to comment
Share on other sites

@powerofos

What effect? You said you wanted an image, GUICtrlCreatePic() gives you that.

Also none of those screenshots contains any "glass", so unless your next post contains an explanation for this seemingly off-topic question, then stop posting here and create your own thread.

Link to comment
Share on other sites

@powerofos

What effect? You said you wanted an image, GUICtrlCreatePic() gives you that.

Also none of those screenshots contains any "glass", so unless your next post contains an explanation for this seemingly off-topic question, then stop posting here and create your own thread.

@AdmiralManHairAlkex,

Ok, i won't post any more, what i need is the background picture with "glass" effect GUI, perhaps my express is not so clearly, sorry about that.

Thanks,

Kim.Y

Link to comment
Share on other sites

@SYRAU3 and @Mikeman27294 the winapi functions you need are in it came with a help file and a lot of examples to look for, these are really good examples for how to put text with shadows using AERO.

@powerofos you have your own thread for that. I thought you had already solved.

@AdmiralManHairAlkex look for powerofos thread is a really good challenge try to do what he want. :)

Edited by monoscout999
Link to comment
Share on other sites

I found this about the same time as this thread, may as well share it with you, I got the transparency working from this project.

That shows the transparency. If you want the UDF that comes with the transparency, look here:

If you want help setting it up, I would be more than happy to help. I dont mind if you PM me, or send me an email, just let me know what you are doing and I will help out.

EDIT

oh... that second link... just realised it is the UDF you have in the first post.

Edited by Mikeman27294
Link to comment
Share on other sites

I did a slight modification to that file.

First, I placed the GUI Creaion within it's own function. The calling of that function is commented out, unless I want to run the script alone, instead of as an include.

I changed the functions so that unless otherwise specified, it will apply the glass effects to the GUI with the handle of $hGUI.

Unless otherwise specified, when creating the thicker title bar, it will go down 31 pixels. This is the same size as that of MSWord 2010 (unless I changed it since, which I am sure I did not).

I think that that's all. I am also working on adding in a ribbon, and I have successfully set it to drag when you grab the extended glass, without grabbing the tabs.

Also, if you run the GUI in this file, it runs both _Vista_ApplyGlassArea, and _Vista_EnableBlurBehind. This is still James Brooks's UDF, I have only modified it for personal use.

Enjoy.

#include <WindowsConstants.au3>

 $Struct = DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight;")
 $sStruct = DllStructCreate("dword;int;ptr;int")

Global $MyArea[4] = [0, 0, 31, 0]
;_GlassTest()
Func _GlassTest()
$hGUI = GUICreate("Windows Vista DWM", 243, 243, 100, 100, $WS_SIZEBOX)
$Apply = GUICtrlCreateButton("Apply", 80, 104, 83, 25, 0)
$ICE = GUICtrlCreateButton("DWM Check", 80, 134, 83, 25, 0)
GUISetState()

While 1
    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case -3
           Exit
        Case $Apply
            ;_Vista_ApplyGlass($hGUI)
            _Vista_ApplyGlassArea($hGUI)
            _Vista_EnableBlurBehind($hGUI)
            GUICtrlSetColor($Apply, 0x000000)
            GUICtrlSetColor($ICE, 0x000000)
        Case $ICE
           If _Vista_ICE() Then
            MsgBox(0, "_Vista_ICE", "DWM is enabled!")
           Else
            MsgBox(0, "_Vista_ICE", "DWM is NOT enabled!")
           EndIf
    EndSwitch
 WEnd
EndFunc

; #FUNCTION#;===============================================================================
;
; Name...........: _Vista_ApplyGlass
; Description ...: Applys glass effect to a window
; Syntax.........: _Vista_ApplyGlass($hWnd, [$bColor)
; Parameters ....: $hWnd - Window handle:
;           $bColor  - Background color
; Return values .: Success - No return
;           Failure - Returns 0
; Author ........: James Brooks
; Modified.......:
; Remarks .......: Thanks to weaponx!
; Related .......:
; Link ..........;
; Example .......; Yes
;
;;==========================================================================================
 Func _Vista_ApplyGlass($hWnd, $bColor = 0x000000)
    If @OSVersion <> "WIN_VISTA" And @OSVersion <> "WIN_7" Then
        MsgBox(16, "_Vista_ApplyGlass", "You are not running Vista!")
    Else
        GUISetBkColor($bColor); Must be here!
        $Ret = DllCall("dwmapi.dll", "long", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "long*", DllStructGetPtr($Struct))
        If @error Then
            Return 0
            SetError(1)
        Else
            Return $Ret
        EndIf
    EndIf
 EndFunc ;==>_Vista_ApplyGlass

; #FUNCTION#;===============================================================================
;
; Name...........: _Vista_ApplyGlassArea
; Description ...: Applys glass effect to a window area
; Syntax.........: _Vista_ApplyGlassArea($hWnd, $Area, [$bColor)
; Parameters ....: $hWnd - Window handle:
;              $Area - Array containing area points
;           $bColor  - Background color
; Return values .: Success - No return
;           Failure - Returns 0
; Author ........: James Brooks
; Modified.......:
; Remarks .......: Thanks to monoceres!
; Related .......:
; Link ..........;
; Example .......; Yes
;
;;==========================================================================================
Func _Vista_ApplyGlassArea($hWnd, $Area=$MyArea, $bColor = 0x000000)
    If @OSVersion <> "WIN_VISTA" And @OSVersion <> "WIN_7" Then
        MsgBox(16, "_Vista_ApplyGlass", "You are not running Vista!")
        Exit
    Else
        If _Vista_ICE() Then
            If IsArray($Area) Then
                DllStructSetData($Struct, "cxLeftWidth", $Area[0])
                DllStructSetData($Struct, "cxRightWidth", $Area[1])
                DllStructSetData($Struct, "cyTopHeight", $Area[2])
                DllStructSetData($Struct, "cyBottomHeight", $Area[3])
                GUISetBkColor($bColor); Must be here!
                $Ret = DllCall("dwmapi.dll", "long*", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "ptr", DllStructGetPtr($Struct))
                If @error Then
                    Return 0
                Else
                    Return $Ret
                EndIf
            Else
                    MsgBox(16, "_Vista_ApplyGlassArea", "Area specified is not an array!")
            EndIf
        Else
            MsgBox(0, "DWM Not Enabled", "DWM is not enabled!")
        EndIf
    EndIf
EndFunc ;==>_Vista_ApplyGlassArea

; #FUNCTION#;===============================================================================
;
; Name...........: _Vista_EnableBlurBehind
; Description ...: Enables the blur effect on the provided window handle.
; Syntax.........: _Vista_EnableBlurBehind($hWnd)
; Parameters ....: $hWnd - Window handle:
; Return values .: Success - No return
;           Failure - Returns 0
; Author ........: James Brooks
; Modified.......:
; Remarks .......: Thanks to komalo
; Related .......:
; Link ..........;
; Example .......; Yes
;
;;==========================================================================================
 Func _Vista_EnableBlurBehind($hWnd, $bColor = 0x000000)
    If @OSVersion <> "WIN_VISTA" And @OSVersion <> "WIN_7" Then
        MsgBox(16, "_Vista_ApplyGlass", "You are not running Vista!")
        Exit
    Else
        Const $DWM_BB_ENABLE = 0x00000001

        DllStructSetData($sStruct, 1, $DWM_BB_ENABLE)
        DllStructSetData($sStruct, 2, "1")
        DllStructSetData($sStruct, 4, "1")

        GUISetBkColor($bColor); Must be here!
        $Ret = DllCall("dwmapi.dll", "int", "DwmEnableBlurBehindWindow", "hwnd", $hWnd, "ptr", DllStructGetPtr($sStruct))
        If @error Then
           Return 0
        Else
           Return $Ret
        EndIf
    EndIf
 EndFunc ;==>_Vista_EnableBlurBehind

; #FUNCTION#;===============================================================================
;
; Name...........: _Vista_ICE
; Description ...: Returns 1 if DWM is enabled or 0 if not
; Syntax.........: _Vista_ICE()
; Parameters ....:
; Return values .: Success - Returns 1
;           Failure - Returns 0
; Author ........: James Brooks
; Modified.......:
; Remarks .......: Thanks to BrettF
; Related .......:
; Link ..........;
; Example .......; Yes
;
;;==========================================================================================
 Func _Vista_ICE()
    $ICEStruct = DllStructCreate("int;")
    $Ret = DllCall("dwmapi.dll", "int", "DwmIsCompositionEnabled", "ptr", DllStructGetPtr($ICEStruct))
    If @error Then
        Return 0
    Else
        Return DllStructGetData($ICEStruct, 1)
    EndIf
 EndFunc ;==>_Vista_ICE

Edited by Mikeman27294
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...