#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
Local $hGUI, $hLabel, $progressbar1, $button, $prc, $hDownload
$hGUI = GUICreate("Прогресс бар", 220, 100, 100, 200)
$progressbar1 = GUICtrlCreateProgress(10, 10, 200, 20)
$hLabel = GUICtrlCreateLabel('', 1, 40, 210, 17, $SS_CENTER)
$button = GUICtrlCreateButton("Старт", 75, 70, 70, 20)
GUISetState()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $button
If GUICtrlRead($button) = 'Выход' Then
Exit
EndIf
Local $hDownload = InetGet("http://download.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_11_active_x.exe", @ScriptDir & "\install_flash_player_11_active_x.exe", 1, 1)
Do
Sleep(100)
$prc = Round(InetGetInfo($hDownload, 0) / (InetGetInfo($hDownload, 1)) * 100)
GUICtrlSetData($progressbar1, $prc)
If $prc >= '1' Then
ControlSetText($hGUI, "Прогресс бар", $hLabel, 'Загружено '&$prc&' % файла')
EndIf
If $prc >= '100' Then
GUICtrlSetData($button, 'Выход')
EndIf
If GUIGetMsg() = $GUI_EVENT_CLOSE Then
InetClose($hDownload)
Exit
EndIf
Until InetGetInfo($hDownload, 2)
InetClose($hDownload)
EndSwitch
WEnd