|
-
September 23rd, 2001, 02:15 PM
#1
Progress bar with a transferring file
I am using the Inet control to transfer files between the local machine and an FTP site. I would like to have a progress bar showing the status of the file being sent/received. I know how to get the size of the file for the max value on the progres bar but is there a way to determine how much of the file has been sent/received already? Any links/tips/suggestions would be helpful, especially if it requires any kind of API call. Thanks 
Ryan
-
September 24th, 2001, 08:14 AM
#2
Re: Progress bar with a transferring file
I cut-and-pasted the example code out of the help file, added a couple of lines (look for the debug.print statement) and was able to come up with something close to what you need:
option Explicit
private Sub Form_Load()
INet1.Document = "PICS.FINANCE.JPG"
INet1.Execute , "get"
End Sub
private Sub Inet1_StateChanged(byval state as Integer)
Dim vtData as Variant
Dim strFileName as string
Dim lngLength as Long
Select Case state
' ... Other cases not shown.
Case icResponseCompleted ' 12
Dim bDone as Boolean: bDone = false
Dim tempArray() as Byte
strFileName = "E:\TestJunk.jpg"
Open strFileName for binary Access Write as #1
' get first chunk.
vtData = INet1.GetChunk(1024, icByteArray)
DoEvents
If len(vtData) = 0 then
bDone = true
End If
Do While Not bDone
tempArray = vtData
Put #1, , tempArray
' get next chunk.
vtData = INet1.GetChunk(1024, icByteArray)
DoEvents
lngLength = lngLength + 1024
Debug.print "Progress: " & lngLength
If len(vtData) = 0 then
bDone = true
End If
Loop
Close #1
End Select
End Sub
-
September 24th, 2001, 10:21 AM
#3
Re: Progress bar with a transferring file
Maybe you can calculate the received part so far and just divide the received file so far by the total size.. And then ask progress bar to show that percentage...
Nic
Nicolas Bohemier
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|