Eine ProgressBar die schon 100% zeigt bevor das Backup fertig ist, wirkt nicht nur unschön sondern verleitet auch dazu schon abzustpüseln. Daher rate ich zur Marquee-Progressbar. Timer kannst du mit AdLibRegister machen.
AutoIt: OnEvent-Modus
#include <GUIConstantsE x.au3>
#include <SendMessage.au3>
#include <ProgressConstants.au3>
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("Form1", 545, 125, 5, 5);, $WS_POPUP, $WS_EX_TOOLWINDOW)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Button1 = GUICtrlCreateButton('&STOP Marquee', 5, 5)
GUICtrlSetOnEvent(-1, "StopResumeMarquee")
$Timer = GUICtrlCreateLabel('Zeit: ', 470, 5, 70)
$Progress1 = GUICtrlCreateProgress(0, 95, 545, 25, $PBS_MARQUEE)
$hProgress = GUICtrlGetHandle($Progress1) ;wichtig
_SendMessage($hProgress, $PBM_SETMARQUEE, True, 10) ;Handle verwenden
GUISetState(@SW_SHOW)
$dtStart = TimerInit()
AdlibRegister('Timer', 1000)
While 1
Sleep(100)
WEnd
Func Timer()
Local $Time = TimerDiff($dtStart) / 1000
Local $HOUR = Int($Time / 3600)
Local $MIN = Int(($Time - $HOUR * 3600) / 60)
Local $SEC = $Time - $HOUR * 3600 - $MIN * 60
GUICtrlSetData($Timer, StringFormat("%02i:%02i:%02i", $HOUR, $MIN, $SEC))
EndFunc ;==>Timer
Func StopResumeMarquee()
If GUICtrlRead($Button1) = '&STOP Marquee' Then
_SendMessage($hProgress, $PBM_SETMARQUEE, False, 10)
GUICtrlSetData($Button1, '&Resume Marquee')
Else
_SendMessage($hProgress, $PBM_SETMARQUEE, True, 10)
GUICtrlSetData($Button1, '&STOP Marquee')
EndIf
EndFunc ;==>StopResumeMarquee
Func Form1Close()
Exit
EndFunc ;==>Form1Close
Alles anzeigen
AutoIt: MsgLoop-Modus
#include <GUIConstantsEx.au3>
#include <SendMessage.au3>
#include <ProgressConstants.au3>
$Form1 = GUICreate("Form1", 545, 125, 5, 5);, $WS_POPUP, $WS_EX_TOOLWINDOW)
$Button1 = GUICtrlCreateButton('&STOP Marquee', 5, 5, 200)
$Timer = GUICtrlCreateLabel('Zeit: ', 470, 5, 70)
$Progress1 = GUICtrlCreateProgress(0, 95, 545, 25, $PBS_MARQUEE)
$hProgress = GUICtrlGetHandle($Progress1)
_SendMessage($hProgress, $PBM_SETMARQUEE, True, 10)
GUISetState(@SW_SHOW)
$dtStart = TimerInit()
AdlibRegister('Timer', 1000)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Button1
If GUICtrlRead($Button1) = '&STOP Marquee' Then
_SendMessage($hProgress, $PBM_SETMARQUEE, False, 10)
GUICtrlSetData($Button1, '&Resume Marquee')
Else
_SendMessage($hProgress, $PBM_SETMARQUEE, True, 10)
GUICtrlSetData($Button1, '&STOP Marquee')
EndIf
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func Timer()
Local $Time = TimerDiff($dtStart) / 1000
Local $HOUR = Int($Time / 3600)
Local $MIN = Int(($Time - $HOUR * 3600) / 60)
Local $SEC = $Time - $HOUR * 3600 - $MIN * 60
GUICtrlSetData($Timer, StringFormat("%02i:%02i:%02i", $HOUR, $MIN, $SEC))
EndFunc ;==>Timer
Alles anzeigen
auch schon bekommen, daß ich bei allzu dummen Fragen gerne gezeigt habe, allerdings meist mit Hinweis was sie lesen sollen.