Hallo 'Gemeinde' *g*,
In der Vergangenheit hatte ich mich mal hier im Forum zum Thema 'Progressbar' geäussert (mal suchen ? ). Nun die Fortsetzung ... seht selbst. :tongue:
Spoiler anzeigen
#NoTrayIcon
Global Const $ES_AUTOVSCROLL = 64
Global Const $ES_AUTOHSCROLL = 128
Global Const $ES_WANTRETURN = 4096
Global Const $WS_POPUPWINDOW = 0x80880000
Global Const $WS_EX_CLIENTEDGE = 0x00000200
Global Const $WS_EX_TOOLWINDOW = 0x00000080
Global Const $WS_GROUP = 0x00020000
Global Const $ES_READONLY = 0x0800
Global Const $GUI_SHOW = 16
Global Const $GUI_HIDE = 32
Global Const $GUI_DISABLE = 128
Global Const $PBS_SMOOTH = 1
Global Const $PBS_VERTICAL = 4
Global Const $SS_LEFT = 0x0000
Global Const $SS_RIGHT = 0x0002
Global Const $SS_CENTER = 0x01
Global Const $WS_EX_OVERLAPPEDWINDOW = 0x00000300
Global Const $WS_EX_TRANSPARENT = 0x00000020
Global Const $SS_NOTIFY = 0x0100
Global $file_size_bytes = 1
Global $file_size = 1
$Datei1 = "sav32sfx.exe"
$Quelle1 = "http://www.sophos.com/tools/sav32sfx.exe"
$Ziel1 = @ScriptDir & $Datei1
$Form1 = GUICreate("", 316, 120, -1, -1,$WS_POPUPWINDOW,$WS_EX_TOOLWINDOW)
GUISetBkColor(0x151843)
GUICtrlSetColor(-1, 0xFFFFFF)
$Group1 = GUICtrlCreateGroup("sophos 'sav32sfx.exe' - download ", 8, 8, 300, 94)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label1 = GUICtrlCreateLabel("",24,30,170,17)
GUICtrlSetColor(-1, 0xFEADA2)
$Label2 = GUICtrlCreateLabel("",24,50,140,17)
GUICtrlSetColor(-1, 0xC0C0FF)
$Label3 = GUICtrlCreateLabel("",225,50,70,17, $SS_RIGHT)
GUICtrlSetColor(-1, 0xFFCB84)
$Label4 = GUICtrlCreateLabel("",230,70,50,17, $SS_RIGHT)
GUICtrlSetColor(-1, 0xE0E0E0)
GUISetState(@SW_SHOW)
_download_progress($Datei1,$Quelle1)
Sleep(1000)
Func _download_progress($filename, $fileurl)
$msg_downloading =""
$file_size_bytes = InetGetSize($fileurl)
$file_size = $file_size_bytes
InetGet($fileurl, $filename, 1, 1)
Global $startDownloadTime = TimerInit()
While @InetGetActive
Sleep(50)
$iniDown = @InetGetBytesRead
$xx1 = Round((($iniDown/$file_size_bytes)*100) , 2)
$xx2 = 24 + $xx1*2
$xx3 = 1 + Floor($xx1)
$Progress1=GUICtrlCreateLabel("",$xx2, 70, 1, 17)
$Farbe=Int(256 - ($xx3 / 128)*255) *65536 + Int((512 * $xx3 / 256)* 255) + Int(($xx3 / 100 * 255) - 512)
GUICtrlSetBkColor($Progress1, $Farbe)
$Left = (($file_Size - @InetGetBytesRead) / $iniDown) * TimerDiff($startDownloadTime)
$msg_load = StringFormat("%03.4f", $iniDown/1048576) & " MB / " & StringFormat("%3.4f", $file_Size/1048576) & " MB"
$msg_zeit = _FormatTime(TimerDiff($startDownloadTime)) & " / " & _FormatTime($Left)
$msg_speed = StringFormat("%3.2f",$iniDown/TimerDiff($startDownloadTime)) & " KB/s"
GUICtrlSetData($Progress1,$xx2)
GUICtrlSetData($Label1,$msg_load)
GUICtrlSetData($Label2,$msg_zeit)
GUICtrlSetData($Label3,$msg_speed)
GUICtrlSetData($Label4,StringFormat("%3.2f",$xx1) & " %")
Wend
EndFunc
Func _FormatTime($_time)
$_hours = Floor($_time / 1000 / 3600)
If $_hours < 10 Then $_hours = "0" & $_hours
$_min = Int($_time / 1000 / 60)
If $_min < 10 Then $_min = "0" & $_min
$_sec = Int($_time / 1000)
If $_sec < 10 Then $_sec = "0" & $_sec
$_millisec = Round(Mod($_time, 100), 0)
If $_millisec < 10 Then $_millisec = "0" & $_millisec
Return $_hours & ":" & $_min & ":" & $_sec & "," & $_millisec
EndFunc
Gruß Trallala
PS: Der Geburtstag war einfach nur göttlich ...