XpSyleToggle Funktion

  • Hallo, ich habe von jemandem diese Funktion hier bekommen:

    Spoiler anzeigen
    [autoit]

    Func XpSyleToggle($onoff = 1)
    Local $xs_n
    If Not StringInStr(@OSTYPE, "WIN32_NT") Then Return 0
    If $onoff Then
    $xs_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties")
    DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
    Return 1
    ElseIf IsArray($xs_n) Then
    DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $xs_n[0])
    $xs_n = ""
    Return 1
    EndIf
    Return 0
    EndFunc ;==>XpSyleToggle

    [/autoit]

    Ich starte diese Funktion beim Erstellen von Progressen, danach beende ich sie "angeblich", damit die kommenden Elemente nicht auch in diesem Style sind. Nur das Problem dabei ist, dass der Style vorhanden bleibt.

    Spoiler anzeigen
    [autoit]

    GUICreate("", 200, 100)
    XpSyleToggle()
    GUICtrlCreateProgress(16, 35, 160, 17)
    GUICtrlSetData(-1, 70)
    GUICtrlSetColor(-1, 0xFF0000)
    XpSyleToggle(0)
    GUISetState()
    GUICtrlCreateButton("click",10,70,160,20)

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

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

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

    Func XpSyleToggle($onoff = 1)
    Local $xs_n
    If Not StringInStr(@OSTYPE, "WIN32_NT") Then Return 0
    If $onoff Then
    $xs_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties")
    DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
    Return 1
    ElseIf IsArray($xs_n) Then
    DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $xs_n[0])
    $xs_n = ""
    Return 1
    EndIf
    Return 0
    EndFunc ;==>XpSyleToggle

    [/autoit]


    Das als Beispiel, der Button ist auch in dem alten Style.
    Die Sufu wollte mir zu dem Begriff auch nichts preisgeben, hoffe ihr könnt mir sagen warum das nicht will. Oder liegt das an Vista?

    Einmal editiert, zuletzt von NoName (7. Dezember 2008 um 14:10)

  • Mach das besser so:

    Spoiler anzeigen
    [autoit]

    Global Const $STAP_ALLOW_NONCLIENT = 0x00000001
    Global Const $STAP_ALLOW_CONTROLS = 0x00000002
    Global Const $STAP_ALLOW_WEBCONTENT = 0x00000004
    Global Const $STAP_ALLOW_NONE =0
    Global Const $STAP_ALLOW_ALL = BitOr($STAP_ALLOW_NONCLIENT,$STAP_ALLOW_CONTROLS,$STAP_ALLOW_WEBCONTENT)
    Global Const $STAP_ALLOW_NOWEBCONTENT = BitOr($STAP_ALLOW_NONCLIENT,$STAP_ALLOW_CONTROLS)

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

    ; Prog@ndy
    Func SetXPStyle($style)
    Local $xs_n
    If Not (@OSTYPE == "WIN32_NT") Then Return -1
    $xs_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties")
    If @error Then Return -1
    DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "dword", $style)
    Return $xs_n[0]
    EndFunc ;==>SetXPStyle

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

    GUICreate("", 200, 100)
    $OLDSTYLE = SetXPStyle($STAP_ALLOW_NONE)
    GUICtrlCreateProgress(16, 35, 160, 17)
    GUICtrlSetData(-1, 70)
    GUICtrlSetColor(-1, 0xFF0000)
    SetXPStyle($OLDSTYLE)
    GUISetState()
    GUICtrlCreateButton("click",10,70,160,20)

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

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

    [/autoit] [autoit][/autoit] [autoit][/autoit]
  • Klappt wunderbar, herzlichen Dank!