#include <InetConstants.au3>
 #include <GUIConstantsEx.au3>
 #include <ButtonConstants.au3>
 #include <EditConstants.au3>
 #include <StaticConstants.au3>
 #include <WindowsConstants.au3>
     $GUI = GUICreate("Téléchargement", 400, 250)
 GUISetBkColor (0xffffff)
 GUICtrlSetColor(-1, 0xff6347)
 GUICtrlSetBkColor(-1, 0xf0f8ff)
 GUICtrlCreateLabel("Lien :",5,5,50,15)
 $strCible = GUICtrlCreateInput("http://ftp.freebsd.org/pub/FreeBSD/ISO-IMAGES-amd64/10.0/FreeBSD-10.0-RELEASE-amd64-dvd1.iso", 55, 5,300,20)
 GUICtrlCreateLabel("Cible :",5,25,50,15)
 $strTarget = GUICtrlCreateInput("FreeBSD-10.0-RELEASE-amd64-dvd1.iso", 55, 25, 250, 20)
 $lancer = GUICtrlCreateButton("Lancer", 25, 50, 80, 20)
 $stopper = GUICtrlCreateButton("Stopper", 130, 50, 80, 20)
 $rzo_lu=GUICtrlCreateLabel("lu", 5, 80, 300, 15)
 $rzo_size=GUICtrlCreateLabel("size", 5, 100, 300, 15)
 $rzo_complete=GUICtrlCreateLabel("complete", 5, 120, 300, 15)
 $rzo_successful=GUICtrlCreateLabel("successful", 5, 140, 300, 15)
 $rzo_erreur=GUICtrlCreateLabel("error", 5, 160, 300, 15)
 $rzo_etendue=GUICtrlCreateLabel("extend", 5, 180, 300, 15)
 GUISetState(@SW_SHOW)
 GUISetOnEvent(-3, "_Exit" )
   While 1
  $nMsg = GUIGetMsg()
  Switch $nMsg
  	Case $GUI_EVENT_CLOSE
    _Exit()
  	Case $lancer
    _lancer()
  	Case $stopper
    _Exit()
  EndSwitch
 WEnd
   Func _lancer()
  GUICtrlSetData($rzo_lu, "Bytes read: initialisation" )
  GUICtrlSetData($rzo_size,"Size: initialisation" )
  GUICtrlSetData($rzo_complete, "Complete: initialisation" )
  GUICtrlSetData($rzo_successful, "successful: initialisation" )
  GUICtrlSetData($rzo_erreur, "@error: initialisation" )
  GUICtrlSetData($rzo_etendue, "@extended: initialisation" )
  Global $sFilePath = GUICtrlRead($strTarget)
  $cible = GUICtrlRead($strCible)
  Global $hDownload = InetGet($cible, $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
  While InetGetInfo()
  	$aData = InetGetInfo($hDownload)
  	GUICtrlSetData($rzo_lu, "Bytes read: " & $aData[$INET_DOWNLOADREAD] )
  	GUICtrlSetData($rzo_size,"Size: " & $aData[$INET_DOWNLOADSIZE] )
  	GUICtrlSetData($rzo_complete, "Complete: " & $aData[$INET_DOWNLOADCOMPLETE] )
  	GUICtrlSetData($rzo_successful, "successful: " & $aData[$INET_DOWNLOADSUCCESS] )
  	GUICtrlSetData($rzo_erreur, "@error: " & $aData[$INET_DOWNLOADERROR] )
  	GUICtrlSetData($rzo_etendue, "@extended: " & $aData[$INET_DOWNLOADEXTENDED] )
  	Sleep(100)
  	$nMsg = GUIGetMsg()
  	Switch $nMsg
    Case $GUI_EVENT_CLOSE
    	_Exit()
    Case $stopper
    	_Exit()
  	EndSwitch
  Wend
  InetClose($hDownload)
 EndFunc
   Func _Exit()
  If (InetGetInfo()) Then
  	InetClose($hDownload)
  EndIf
     Exit
 EndFunc   ;==>_Exit  |