Prikazi cijelu temu 20.04.2015 09:34
Avko Van mreze
Administrator
Registrovan od:28.05.2014
Lokacija:zagreb


Predmet:Re: DoEvents naredba
onda bi to bilo ovako:
PreuzmiIzvorni kôd (Visual Basic):
  1. Public Sub DownloadFile(strURL As String, strDestination As String)  'As Boolean
  2.    Const CHUNK_SIZE As Long = 1024
  3.     Dim intFile As Integer
  4.     Dim lngBytesReceived As Long
  5.     Dim lngFileLength As Long
  6.     Dim strHeader As String
  7.     Dim b() As Byte
  8.     Dim i As Integer
  9.     Dim ip As String
  10.     Dim ipurl As String
  11.    
  12.     ipurl = "http://www.icentar.ba/ip.php"
  13.     ip = Inet1.OpenURL(ipurl, icString)
  14.     MsgBox ip
  15.    
  16.         DoEvents
  17.        
  18.         With Inet1
  19.                 .url = strURL
  20.                 .Execute , "GET", , "Range: bytes=" & CStr(lngBytesReceived) & "-" & vbCrLf
  21.                
  22.                 While .StillExecuting
  23.                         DoEvents
  24.                 Wend
  25.                
  26.                 strHeader = .GetHeader
  27.         End With
  28.        
  29.         strHeader = Inet1.GetHeader("Content-Length")
  30.         lngFileLength = Val(strHeader)
  31.     DoEvents
  32.    
  33.         lngBytesReceived = 0
  34.         intFile = FreeFile()
  35.        
  36.         Open strDestination For Binary Access Write As #intFile
  37.                 Do
  38.                         b = Inet1.GetChunk(CHUNK_SIZE, icByteArray)
  39.                         Put #intFile, , b
  40.                         lngBytesReceived = lngBytesReceived + UBound(b, 1) + 1
  41.                         DownloadProgress (Round((lngBytesReceived / lngFileLength) * 100))
  42.                         DoEvents
  43.                 Loop While UBound(b, 1) > 0
  44.        
  45.         Close #intFile
  46. End Sub

zivot je moja domovina.