_Vista_ApplyGlass & Area

  • Das ist ein Script, um die Darstellung des guis mit der Aero wasweissich machen.
    Testet es mal. und nein, das script is nich mir, habs mal in meinem usb-stick gefunden.

    Code
    [autoit]

    $Struct = DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight;")
    Func _Vista_ApplyGlass($hWnd, $bColor = 0x000000)
    If @OSVersion <> "WIN_VISTA" and @OSVersion <> "WIN_7" Then
    MsgBox(16, "_Vista_ApplyGlass", "You are not running Vista!")
    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

    [/autoit] [autoit][/autoit] [autoit]

    Func _Vista_ApplyGlassArea($hWnd, $Area, $bColor = 0x000000)
    If @OSVersion <> "WIN_VISTA" and @OSVersion <> "WIN_7" Then
    MsgBox(16, "_Vista_ApplyGlass", "You are not running Vista!")
    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

    [/autoit]
    Beispiel
    [autoit]

    $hWnd = GuiCreate("is egal",?,?,?,?)
    _Vista_ApplyGlass($hWnd,$bColor = 0x000000) ; 0x000000 ist für den aktuellen Farbe
    ...

    [/autoit]


    nich pöse sein, is mein erster Code Post


    Edit: der code im Spoiler wurde geändert! der script im anhang ist noch der alte

    Einmal editiert, zuletzt von bbm1995 (15. April 2010 um 16:37)

    • Offizieller Beitrag
  • Hi

    Es geht auch auf Win7
    daher solltest du es folgendermaßen ändern

    Spoiler anzeigen
    [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

    $hWnd = GUICreate("is egal")
    _Vista_ApplyGlass($hWnd, 0x000000) ; 0x000000 ist für den aktuellen Farbe

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Switch GUIGetMsg()
    Case -3
    Exit
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _Vista_ApplyGlass($hWnd, $bColor = 0x000000)
    If @OSVersion <> "WIN_VISTA" And @OSVersion <> "WIN_7" Then
    MsgBox(16, "_Vista_ApplyGlass", "You are not running Vista!")
    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

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit]

    Einfach einfügen

    gruß Simon

    • Offizieller Beitrag

    Wenn schon, dann bei beiden Funktionen:

    Spoiler anzeigen
    [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

    $hWnd = GUICreate("is egal")
    _Vista_ApplyGlass($hWnd, 0x000000) ; 0x000000 ist für den aktuellen Farbe

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Switch GUIGetMsg()
    Case -3
    Exit
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _Vista_ApplyGlass($hWnd, $bColor = 0x000000)
    If @OSVersion <> "WIN_VISTA" And @OSVersion <> "WIN_7" Then
    MsgBox(16, "_Vista_ApplyGlass", "You are not running Vista!")
    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

    [/autoit] [autoit][/autoit] [autoit]

    Func _Vista_ApplyGlassArea($hWnd, $Area, $bColor = 0x000000)
    If @OSVersion <> "WIN_VISTA" And @OSVersion <> "WIN_7" Then
    MsgBox(16, "_Vista_ApplyGlass", "You are not running Vista!")
    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

    [/autoit]
  • Oh sry hab ich übersehen
    Aber müsste man dann den Funktionsname nciht ändern da es ja nicht nur für vista ist ???

    gruß Simon

  • danke für die verbesserungen

    @simon (15:36)

    dann müsste es ja vlt. Win7VistapplyGlass heissen (XD Vistapply)

    der script geht nur für Win Vista und höher weil XP nicht Aero unterstützt(glaub ich)


    ich werde es mal schnell verbessern


    Edit: sollte es nicht or anstatt and heissen?

  • Nim hald ds Vista raus und setze im func name nur win ein , man merkt es ja eh am msgbox ob es geht !

    gruß Simon

    • Offizieller Beitrag
    Zitat

    Edit: sollte es nicht or anstatt and heissen?

    Natürlich hast du recht, es muß Or und nicht And heißen.
    OMG, ich bin heute Blind und unfähig. Erst testen, dann posten. 8|

    Spoiler anzeigen
    [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

    $hWnd = GUICreate("is egal")
    _Aero_ApplyGlass($hWnd, 0x000000) ; 0x000000 ist für den aktuellen Farbe

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Switch GUIGetMsg()
    Case -3
    Exit
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _Aero_ApplyGlass($hWnd, $bColor = 0x000000)
    If @OSVersion <> "WIN_VISTA" And @OSVersion <> "WIN_7" Then
    MsgBox(16, "_Aero_ApplyGlass", "You are not running Vista/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

    [/autoit] [autoit][/autoit] [autoit]

    Func _Aero_ApplyGlassArea($hWnd, $Area, $bColor = 0x000000)
    If @OSVersion <> "WIN_VISTA" And @OSVersion <> "WIN_7" Then
    MsgBox(16, "_Vista_ApplyGlass", "You are not running Vista/Win7!")
    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, "_Aero_ApplyGlassArea", "Area specified is not an array!")
    EndIf
    EndIf
    EndFunc ;==>_Vista_ApplyGlassArea

    [/autoit]


    DIe Funktionsnamen sind aber sowas von Wurst.

  • Nein es muss AND heisen als ich es erst mit or hatte kam die meldung als ich AND eingesetzt hatte ging es !

    gruß Simon

  • ok, aber die bool'eanischen oder wie immer die auch heissen(interessiert mich nicht) sind voll verwirrend
    glaub, hat sich erledigt,das thema

  • Mal kurtz ne Frage: (Ja, ich weiß dass der Theard veraltet ist ... :whistling: )
    Wie bindet man dass ganze in ein Skrit ein?

    Bei mir sieht dass so aus:

    [autoit]


    $bColor = 0x000000
    $hWnd = GuiCreate("is egal")
    _Vista_ApplyGlass($hWnd,$bColor)

    [/autoit]

    Mir meldet dann immer AutoIt/Scite :

    Zitat

    C:\UsersSkript-Bär\Desktop\0.au3 (3) : ==> Unknown function name.:
    _Vista_ApplyGlass($hWnd,$bColor)
    ^ ERROR
    >Exit code: 1 Time: 0.229

    Ich glaub dass das einbauen irgendwie anders geht ....

  • das zuunterst oder als seperate datei und dann als include

    script:

    Spoiler anzeigen
    [autoit]

    $Struct = DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight;")
    Func _Vista_ApplyGlass($hWnd, $bColor = 0x000000)
    If @OSVersion <> "WIN_VISTA" and @OSVersion <> "WIN_7" Then
    MsgBox(16, "_Vista_ApplyGlass", "You are not running Vista!")
    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

    [/autoit] [autoit][/autoit] [autoit]

    Func _Vista_ApplyGlassArea($hWnd, $Area, $bColor = 0x000000)
    If @OSVersion <> "WIN_VISTA" and @OSVersion <> "WIN_7" Then
    MsgBox(16, "_Vista_ApplyGlass", "You are not running Vista!")
    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

    [/autoit]
  • entweder deins, oder das include datei muss im gleichen ordner wie das script sein. (@ScriptDir)
    ;)
    besser, wenn man die Funktion im Script ganz unten einfügt

  • Wenn es in deinem Scriptordner drin ist muss es aber

    [autoit]

    #include "Name.au3"

    [/autoit]


    heißen.