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:
  1. Dim byteArr() As Byte
  2.  
  3. byteArr = LoadResData(101,"CUSTOM")
  4.  
  5. Open theFile$ For Binary As #1
  6. Put #1, , byteArr
  7. Close #1

is 100 times faster (according to GetTickCount) than this code:

VB Code:
  1. Dim byteArr() As Byte
  2. Dim i as Integer
  3.  
  4. byteArr = LoadResData(101,"CUSTOM")
  5.  
  6. Open theFile$ For Binary As #1
  7. For i = 0 To Ubound(byteArr)
  8. Put #1, , byteArr(i)
  9. UpdateStatus Int((i+1)/(Ubound(byteArr)+1)*100) 'update progressbar
  10. Next
  11. Close #1

I would like to keep a progress bar on the writing, but I cannot have something which is so slow. Any ideas?