Now I use wininet.dll library to get file and calculate progres of dowloading action ....
it is something like this:
I'm considering is it posible to do that with "WinHttp.WinHttpRequest.5.1" or "Msxml2.ServerXMLHTTP.5.0")
eg:
Any idea, will be helpfull
it is something like this:
Code:
Do
If InternetReadFile(hRequest, VarPtr(Buffer(0)), BUF_SIZE, dwBytesRead) Then
If WriteFile(hFile, VarPtr(Buffer(0)), dwBytesRead, dwBytesWritten, 0) Then
' TODO:// calculate progress
dwStatus = (dwStatus + dwBytesWritten)
dwPercent = (dwStatus / dwFileSize) * 100
Debug.Print dwPercent
'form1.Caption = dwPercent '<-- change this
Else
Debug.Print "WriteFile error"; ERR.LastDllError
Exit Do
End If
Else
Debug.Print "InternetReadFile error"; ERR.LastDllError
Exit Do ' _leave
End If
DoEvents
Loop Until dwBytesRead = 0
I'm considering is it posible to do that with "WinHttp.WinHttpRequest.5.1" or "Msxml2.ServerXMLHTTP.5.0")
eg:
Code:
Set request = CreateObject("WinHttp.WinHttpRequest.5.1")
lResolve = 5 * 1000
lConnect = 5 * 1000
lSend = 0 * 1000
lReceive = 0 * 1000 'waiting time to receive data from server
'WinHttpReq.setTimeout 10000
request.setTimeouts lResolve, lConnect, lSend, lReceive
With request
.Open "GET", URL, False
.send
...
End With
Set request = Nothing