\r\n\r\n
Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Communications > WinHTTP OnResponseDataAvailable Event


\r\n \r\n
 
 
Thread Tools Display Modes

\r\n\r\n\r\n
can someone instruct me how to construct/use this event... ive never done it before
\r\n
\r\ni just need to find a way to get the size of the downloaded data.
\r\n
\r\ni can already get the file size before downloading but want to make a progress bar... pb1.value = ubound(data())/tSize * 100
\r\n
\r\nHere is the code im using to download a file:
\r\n
\r\n
Code:
\r\n
Dim WinHttpReq As WinHttp.WinHttpRequest\r\n\r\nPublic Sub DLFile(strHTTPFile As String, strFileDest As String)\r\nSet WinHttpReq = New WinHttpRequest\r\nDim FNum As Integer\r\nFNum = FreeFile\r\n\' Create an array to hold the response data.\r\nDim d() As Byte\r\n\' Assemble an HTTP Request.\r\nWinHttpReq.Open "GET", strHTTPFile, False\r\nWinHttpReq.Send\r\n\' Put response data into a file.\r\nd() = WinHttpReq.ResponseBody\r\nOpen strFileDest For Binary As FNum\r\nPut FNum, 1, d()\r\nClose FNum\r\nNextFile = True\r\nSet WinHttpReq = Nothing\r\nEnd Sub
\r\n
i would like someone to help me make it so i can monitor the size of the data being retrieved for a download progress bar...
\r\n
\r\nthank you in advance...
\r\n \r\n\r\n
\r\n \r\n\r\n \r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n
\r\n \r\n \r\n \r\n \r\n Reply With Quote\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n \r\n\r\n
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n'; pd[1306454] = '\r\n\r\n \r\n\r\n
\r\n
\r\n
\r\n\r\n
\r\n \r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n \r\n
\r\n
\r\n  \r\n #2  \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n
\r\n \r\n Old\r\n \r\n 09-30-2008, 01:12 PM\r\n \r\n \r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n
dilettante\'s Avatar\r\n\r\n
\r\n \r\n dilettante\r\n dilettante is offline\r\n\r\n\r\n
Prev Previous Post   Next Post Next
  #1  
Old 09-29-2008, 07:01 PM
viraco viraco is offline
Newcomer
 
Join Date: Sep 2008
Posts: 8
Default WinHTTP OnResponseDataAvailable Event


can someone instruct me how to construct/use this event... ive never done it before

i just need to find a way to get the size of the downloaded data.

i can already get the file size before downloading but want to make a progress bar... pb1.value = ubound(data())/tSize * 100

Here is the code im using to download a file:
Code:
Dim WinHttpReq As WinHttp.WinHttpRequest

Public Sub DLFile(strHTTPFile As String, strFileDest As String)
Set WinHttpReq = New WinHttpRequest
Dim FNum As Integer
FNum = FreeFile
' Create an array to hold the response data.
Dim d() As Byte
' Assemble an HTTP Request.
WinHttpReq.Open "GET", strHTTPFile, False
WinHttpReq.Send
' Put response data into a file.
d() = WinHttpReq.ResponseBody
Open strFileDest For Binary As FNum
Put FNum, 1, d()
Close FNum
NextFile = True
Set WinHttpReq = Nothing
End Sub
i would like someone to help me make it so i can monitor the size of the data being retrieved for a download progress bar...

thank you in advance...
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->