Writing binary file with progress
I am at present writing binary from a custom resource to a file. However I would like to keep a status bar recording the progress of the writing. Unfortunately this code (has no progress bar):
VB Code:
Dim byteArr() As Byte
byteArr = LoadResData(101,"CUSTOM")
Open theFile$ For Binary As #1
Put #1, , byteArr
Close #1
is 100 times faster (according to GetTickCount) than this code:
VB Code:
Dim byteArr() As Byte
Dim i as Integer
byteArr = LoadResData(101,"CUSTOM")
Open theFile$ For Binary As #1
For i = 0 To Ubound(byteArr)
Put #1, , byteArr(i)
UpdateStatus Int((i+1)/(Ubound(byteArr)+1)*100) 'update progressbar
Next
Close #1
I would like to keep a progress bar on the writing, but I cannot have something which is so slow. Any ideas?
It depends on the file size though
I was writing a 440 K file and I got:
19,2124
20,2090
19,2143
19,2119
And then you would have to have the status updating...