Sign in to follow this  
Followers 0
SYRAU3

A question about Win 7 GUI Aero Trasnpacey

15 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



Oh i really thank you... thanks for your time. :) *(KISS)

Share this post


Link to post
Share on other sites

How to make a Button Control or a TreeView with none transperated background!! black text still disapears... :)

Share this post


Link to post
Share on other sites

A little help please :) ........!

Share this post


Link to post
Share on other sites

Hello,

Similarly, i wonder how to put a picture as my GUI background (jpg or png format) which can place in full size, just like the photo in attachment!

Regards

Kim.Y

post-41874-0-26186100-1310461232_thumb.j

post-41874-0-98350800-1310461242_thumb.j

Share this post


Link to post
Share on other sites

@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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Are there any examples for the winAPI function? I want to add it to my scripts but I have no background in winAPI, and could not find a winAPI startup function or anything like that, so I am absolutely lost.

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

@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

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

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

Share this post


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
Sign in to follow this  
Followers 0