Jump to content

Recommended Posts

Posted

That is because @OS_TYPE returns the windows family the user is running, not the current version of windows.

Try @OS_Version instead muttley

Someone punch me! Thanks!

I have recreated this in VB6 and I know why the control does not appear correctly after "glassification". In the VB6 version, I can create the tRect which covers and inside area which does not get the glass effect. Anything inside that area is left alone, thus keeping the controls how they should be.

Posted

I have done, but another read won't harm me, it might be really useful!

Edit: Nope, because I don't know how to create a MARGINS structure.

This is how:

$struct=DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight;")

Broken link? PM me and I'll send you the file!

Posted (edited)

Ok, so I can just change the values to the $Area array?

Edit: Just some code:

$Area[4] = [50, 50, 50, 50]

Func _Vista_ApplyGlassArea($hWnd, $Area, $bColor = 0x000000)
    If @OSVersion <> "WIN_VISTA" Then
        MsgBox(16, "_Vista_ApplyGlass", "You are not running Vista!")
        Exit
    Else
        If IsArray($Area) Then
            GUISetBkColor($bColor); Must be here!
            Return DllCall("dwmapi.dll", "long*", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "long*", $Area[0])
        Else
            MsgBox(16, "_Vista_ApplyGlassArea", "Area specified is not an array!")
        EndIf
    EndIf
EndFunc  ;==>_Vista_ApplyGlassArea

If you test it, you will only get the left hand side with the glass effect. How do I use the code from above to create the margins?

Edited by JamesBrooks
Posted (edited)

No, no, no, you've got this all mixed up.

Here's how you should do it:

$hwnd=GUICreate("sample",300,300)
GUISetState()

$struct=DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight;")
DllStructSetData($struct,"cxLeftWidth",130)
DllStructSetData($struct,"cxRightWidth",3)
DllStructSetData($struct,"cyTopHeight",0)
DllStructSetData($struct,"cyBottomHeight",25)
GUISetBkColor(0x000000)
DllCall("dwmapi.dll", "int", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "ptr", DllStructGetPtr($struct))

Do
    $msg=GUIGetMsg()
    
Until $msg=-3

Now play with the values in the struct until you understand what they mean muttley

Edited by monoceres

Broken link? PM me and I'll send you the file!

Posted (edited)

Just use this and you'll have a full red glass window

#include <StructureConstants.au3>
#include <GUIConstants.au3>

$GUI = GUICreate("Windows Vista DWM", 243, 243)
$Apply = GUICtrlCreateButton("Apply", 80, 104, 83, 25, 0)
GUISetState(@SW_SHOW)

While 1
     $iMsg = GUIGetMsg()
     Switch $iMsg
         Case $GUI_EVENT_CLOSE
             Exit
         Case $Apply
                 $Ret = ApplyGlass($GUI,243,243,243,243,0xFF0000); produces full glass window, the glass is red colored
     EndSwitch
WEnd

Func ApplyGlass($hWnd,$leftw,$rightw,$toph,$bottomh,$glasscolor = "0x000000")
$struct=DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight;")
DllStructSetData($struct,"cxLeftWidth",$leftw)
DllStructSetData($struct,"cxRightWidth",$rightw)
DllStructSetData($struct,"cyTopHeight",$toph)
DllStructSetData($struct,"cyBottomHeight",$bottomh)
GUISetBkColor($glasscolor)
Return DllCall("dwmapi.dll", "int", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "ptr", DllStructGetPtr($struct))
EndFunc
Edited by LIMITER
Posted

Wow this is amazing! My Dad thinks this is great! Did you people know you can use a different windows handle like Notepad? ACE!

[center][font="Arial"]If practise makes perfect and no-ones perfect whats the point of practise?[/font]Sorry for my rude attitude when I started here.[/center]

Posted (edited)

Check the edited post (Post #30)

It resolves all the errors muttley

P.S.

This is the output:

Posted Image

Edited by LIMITER
Posted

Just one more thing, $tagMargins is the exact same thing as the struct I created so you can replace my DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight;") with DllStructCreate($tagMargins)

muttley

Broken link? PM me and I'll send you the file!

Posted

Monoceres, that means no need for StructureConstants.au3?

If you like, I'm just saying that you don't need to use both DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int yBottomHeight;") and DllStructCreate($tagMargin)

Broken link? PM me and I'll send you the file!

Posted

Wow this is amazing! My Dad thinks this is great! Did you people know you can use a different windows handle like Notepad? ACE!

WinGetHandle()

Broken link? PM me and I'll send you the file!

Posted (edited)

Note: If you want only a little bit of the GUI such as the bottom to be effected then here is an example showing you how:

#include <GUIConstants.au3>
#include <Vista.au3>

Global $Area[4] = [0, 0, 0, 76]

$GUI = GUICreate("GUI", 408, 181)
GUICtrlCreateLabel("I shall not be affected by the Glass!", 112, 64, 170, 17)
GUICtrlCreateLabel("", 0, 105, 408, 76)
GUICtrlSetBkColor(-1, 0x000000)
_Vista_ApplyGlassArea($GUI, $Area, 0xE2E2E2)

GUISetState(@SW_SHOW)

While 1
    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Have fun!

Edit: Here is a screenshot!

Posted Image

I have fixed the little white line seen in the screenshot!

Edited by JamesBrooks
Posted

WinGetHandle()

Yeah! I know, I was just saying muttley

Note: If you want only a little bit of the GUI such as the bottom to be effected then here is an example showing you how:

#include <GUIConstants.au3>
#include <Vista.au3>

Global $Area[4] = [0, 0, 0, 77]

$GUI = GUICreate("GUI", 408, 181)
GUICtrlCreateLabel("I shall not be affected by the Glass!", 112, 64, 170, 17)
GUICtrlCreateLabel("", 0, 104, 408, 76)
GUICtrlSetBkColor(-1, 0x000000)
_Vista_ApplyGlassArea($GUI, $Area, 0xE2E2E2)

GUISetState(@SW_SHOW)

While 1
    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

If you created the label at the bottom of the GUI then you need to edit the last $Area co-ordinate and + 1 to it so it will cover it properly.

Have fun!

Neat example James. I see you have also updated System Properties Wrapper with the GUI nice! 5 stars for both scripts!

[center][font="Arial"]If practise makes perfect and no-ones perfect whats the point of practise?[/font]Sorry for my rude attitude when I started here.[/center]

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.
×
×
  • Create New...