Ferme un handle retourné par InetGet().
InetClose ( handle )
handle | Le handle retourné par InetGet(). |
True: | Le handle a été trouvé et fermé. |
False: | Sinon. |
#include <InetConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> Example() Func Example() ; Enregistre le fichier téléchargé dans le dossier temporaire. Local $sFilePath = _WinAPI_GetTempFileName(@TempDir) ; Télécharge le fichier en arrière-plan avec l'option choisie de "forcer le chargement du site distant." Local $hDownload = InetGet("http://www.autoitscript.com/autoit3/files/beta/update.dat", $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) ; Attend la fin du téléchargement en vérifiant si la valeur du 2nd index de InetGetInfo retourne True. Do Sleep(250) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) ; Récupére le nombre total d'octets reçus et la taille du fichier. Local $iBytesSize = InetGetInfo($hDownload, $INET_DOWNLOADREAD) Local $iFileSize = FileGetSize($sFilePath) ; Ferme le handle retourné par InetGet. InetClose($hDownload) ; Affiche les détails sur le nombre total d'octets lus et la taille du fichier. MsgBox($MB_SYSTEMMODAL, "", "Taille totale: " & $iBytesSize & @CRLF & _ "Taille totale du fichier: " & $iFileSize) ; Supprime le fichier. FileDelete($sFilePath) EndFunc ;==>Example