Endloser Fortschrittsbalken

  • Guten Tag,

    weil das Thema so viel Interesse weckt, gibt es auch noch ein ausbaufähiges, spielerisches Beispiel von mir:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

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

    GUICreate('"Marquee" Progress (RTL)', 300, 110)
    $idPgr = GUICtrlCreateProgress(20, 20, 260, 25)
    _RemoveTheme(-1)
    GUICtrlSetBkColor(-1, 0)
    $idBtn = GUICtrlCreateButton("Und Tschüss!", 20, 65, 260, 25)
    AdlibRegister("_AnimateProgress", 10)
    GUISetState()

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

    While True
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    ExitLoop
    Case $idBtn
    ExitLoop
    EndSwitch
    WEnd
    Exit

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

    Func _AnimateProgress()
    Static $I = 0
    Static $D = 1
    Static $C = 0X00FF00 - (0x200 * 101)
    Static $RTL = False
    Select
    Case $I > 100
    If $RTL Then
    GUICtrlSetStyle($idPgr, -1, 0)
    $RTL = False
    Else
    GUICtrlSetStyle($idPgr, -1, $WS_EX_LAYOUTRTL)
    $RTL = True
    EndIf
    $D *= -1
    Case $I < 0
    $D *= -1
    EndSelect
    $I += $D
    GUICtrlSetColor($idPgr, $C + (0x200 * $I))
    GUICtrlSetData($idPgr, $I)
    EndFunc

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

    Func _RemoveTheme($hCtrl)
    If Not IsHWnd($hCtrl) Then $hCtrl = GUICtrlGetHandle($hCtrl)
    If IsHWnd($hCtrl) Then
    Local $aR = DllCall("UxTheme.dll", "Long", "SetWindowTheme", "HWND", $hCtrl, "Ptr", 0, "WStr", " ")
    If Not @error And $aR[0] = 0 Then Return True
    EndIf
    Return False
    EndFunc

    [/autoit]

    (Getestet unter Vista)

    • Offizieller Beitrag

    @Großvater, auch ein schönes Beispiel. :thumbup:
    Kommt gleich in meine Sammlung.