Results 1 to 8 of 8

Thread: dowenloading large files with Inet

  1. #1

    Thread Starter
    Hyperactive Member deane034's Avatar
    Join Date
    May 2001
    Location
    Sri Lanka
    Posts
    485

    dowenloading large files with Inet

    ok guys... this is a sub i created form a code i collected from somewhere.... but the thing is.. i cant.. donwload large files with it.. how do i correct this problem?

    *******************************************


    Private Sub Download(strURL As String)
    Dim b() As Byte
    Dim intCount As Integer
    Dim strData As String

    Inet.Cancel ' Stops any current operations

    b() = Inet.OpenURL(strURL, icByteArray)

    For intCount = 0 To UBound(b) - 1

    strData = strData & Chr(b(intCount))

    Next intCount


    Open App.Path & NextFile For Output As #1

    Print #1, strData

    Close #1
    MsgBox "d"

    End Sub
    me.life = VB

  2. #2
    Let me in .. techyspecy's Avatar
    Join Date
    Aug 2002
    Location
    Back to VBF.
    Posts
    2,456

    Re: dowenloading large files with Inet

    Originally posted by deane034
    ok guys... this is a sub i created form a code i collected from somewhere.... but the thing is.. i cant.. donwload large files with it.. how do i correct this problem?

    *******************************************


    Private Sub Download(strURL As String)
    Dim b() As Byte
    Dim intCount As Integer
    Dim strData As String

    Inet.Cancel ' Stops any current operations

    b() = Inet.OpenURL(strURL, icByteArray)

    For intCount = 0 To UBound(b) - 1

    strData = strData & Chr(b(intCount))

    Next intCount


    Open App.Path & NextFile For Output As #1

    Print #1, strData

    Close #1
    MsgBox "d"

    End Sub
    There is a direct API to download files from Net if you know the URL of the file. In your case i think you know the url in advance.

    I think it is DoFileDownload API defined in shdocvw.dll

    Declare Function DoFileDownload Lib "shdocvw.dll" (ByVal lpszFile As String) As Long

    Just pass the file Url to it and it will do the trick for you.

  3. #3

    Thread Starter
    Hyperactive Member deane034's Avatar
    Join Date
    May 2001
    Location
    Sri Lanka
    Posts
    485
    thanks man ... i diddnt try it.. but it shud work right
    me.life = VB

  4. #4

    Thread Starter
    Hyperactive Member deane034's Avatar
    Join Date
    May 2001
    Location
    Sri Lanka
    Posts
    485

    Unhappy

    well.. the DoFileDownload fucntion.. kinda opens up a iE dialouge box.. i dont want that.. is there any fix for the inet control... coz.. i think it's the size.. the page i am tryin to donwload has abt 70 000 characters...
    me.life = VB

  5. #5
    Let me in .. techyspecy's Avatar
    Join Date
    Aug 2002
    Location
    Back to VBF.
    Posts
    2,456
    Originally posted by deane034
    well.. the DoFileDownload fucntion.. kinda opens up a iE dialouge box.. i dont want that.. is there any fix for the inet control... coz.. i think it's the size.. the page i am tryin to donwload has abt 70 000 characters...
    All you have to do is mark the checkbox on that window which says close automatically when download is done. You only have to do that once. From next time on if you download something it will download the file and close automatically.

    Whats the problem in that ???

  6. #6

    Thread Starter
    Hyperactive Member deane034's Avatar
    Join Date
    May 2001
    Location
    Sri Lanka
    Posts
    485

    Unhappy

    well.. no..coz.. this shud be automated.. that wud be iritattin
    me.life = VB

  7. #7
    Let me in .. techyspecy's Avatar
    Join Date
    Aug 2002
    Location
    Back to VBF.
    Posts
    2,456
    Originally posted by deane034
    well.. no..coz.. this shud be automated.. that wud be iritattin
    Jesus Christ - Whats irritating with it. Its actually neat and better. It tells you all kinda information about download speed, how much download etc etc ...Even if it remain opens after download user can always close it. What does it takes to close a window.

    Man u r some chooosy !!!

  8. #8

    Thread Starter
    Hyperactive Member deane034's Avatar
    Join Date
    May 2001
    Location
    Sri Lanka
    Posts
    485
    i feel i am a IE slave well.. anyeays.. i got this API

    so.. i tihnk i;ll use this one..

    Private Declare Function URLDownloadToFile Lib "urlmon" _
    Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL _
    As String, ByVal szFileName As String, ByVal dwReserved As Long, _
    ByVal lpfnCB As Long) As Long
    Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
    Dim lngRetVal As Long
    lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
    If lngRetVal = 0 Then DownloadFile = True
    End Function
    me.life = VB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width