#include #include #include ; Download a file in the background. ; Wait for the download to complete. Example() Func Example() ; Save the downloaded file to the temporary folder. Local $sFilePath = "d:\" ; Download the file in the background with the selected option of 'force a reload from the remote site.' ;Local $hDownload = InetGet("https://en.wikipedia.org/wiki/HTTPS#/media/File:Internet2.jpg", $sFilePath & "Internet2.jpg", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) Local $hDownload = InetGet("https://upload.wikimedia.org/wikipedia/commons/thumb/d/da/Internet2.jpg/1024px-Internet2.jpg", $sFilePath & "Internet2.jpg", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) ; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True. Do Sleep(250) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) Local $aData = InetGetInfo($hDownload) ;Retrieve details about the download file. If InetGetInfo($hDownload, $INET_DOWNLOADSUCCESS) Then ;If the download was successfull, return the target location ; Retrieve the number of total bytes received and the filesize. Local $iBytesSize = InetGetInfo($hDownload, $INET_DOWNLOADREAD) Local $iFileSize = FileGetSize($sFilePath & "Internet2.jpg") ; Display details about the total number of bytes read and the filesize. MsgBox($MB_SYSTEMMODAL, "", "The total download size: " & $iBytesSize & @CRLF & _ "The total filesize: " & $iFileSize) Else ;If the download failed, set @error and return False Local $errorCode = InetGetInfo($hDownload, $INET_DOWNLOADERROR) If $aData[$INET_DOWNLOADERROR] = 13 Then MsgBox($MB_ICONWARNING, "Fehler", "Die Datei wurde auf dem Server nicht gefunden!") Else MsgBox($MB_ICONWARNING, "Es ist ein Fehler aufgetreten.", "Bytes read: " & $aData[$INET_DOWNLOADREAD] & @CRLF & _ "Size: " & $aData[$INET_DOWNLOADSIZE] & @CRLF & _ "Complete: " & $aData[$INET_DOWNLOADCOMPLETE] & @CRLF & _ "Successful: " & $aData[$INET_DOWNLOADSUCCESS] & @CRLF & _ "@error: " & $aData[$INET_DOWNLOADERROR] & @CRLF & _ "@extended: " & $aData[$INET_DOWNLOADEXTENDED] & @CRLF) EndIf EndIf ; Close the handle returned by InetGet. InetClose($hDownload) ; Delete the file. ;FileDelete($sFilePath) EndFunc ;==>Example