Results 1 to 7 of 7

Thread: Using WebBrowser Object to download files

  1. #1

    Thread Starter
    Fanatic Member Kzin's Avatar
    Join Date
    Dec 2000
    Posts
    611

    Question

    Short of dragging the Cache does anyone know how to use the WebBrowser Object to download EXE and binary files "transparently" to a predetermined directory on the computer?

    WebBrowser1.Navigate "http://www.mydomain.com/download/setupex.exe"

    will obviously do it with a pop-up box but I need the download to be "silent". This is my great chance to get rid of the retched ICK control

  2. #2
    Hyperactive Member PJB's Avatar
    Join Date
    Aug 2000
    Location
    dunno at the moment
    Posts
    302
    Not sure if this is what your looking for or not, i've never tried it, i just did i quick search and this popped up so give it a look
    http://www.vb-world.net/internet/tip501.html
    VB6.0 SP4
    Windows 2000
    I'm thinking of a number between

  3. #3

    Thread Starter
    Fanatic Member Kzin's Avatar
    Join Date
    Dec 2000
    Posts
    611

    Thumbs up Thanks

    Thanks - that looks very promising - I'll try it and tell you what happens!

  4. #4

    Thread Starter
    Fanatic Member Kzin's Avatar
    Join Date
    Dec 2000
    Posts
    611

    Question Yes it works but . .

    . .any idea about how I can hold the execution of the next lines until the download has occurred?
    ---
    BTW - what's happening to the cat in you sig file?

  5. #5

    Thread Starter
    Fanatic Member Kzin's Avatar
    Join Date
    Dec 2000
    Posts
    611

    Cool

    OK - found the answer -

    The function will then use the API to download the file and return a True if successful.

    Thanks

  6. #6
    Lively Member
    Join Date
    Jan 2001
    Location
    St. Louis, MO USA
    Posts
    77

    Lightbulb

    Here is some code that worked for me:

    Private Sub Command1_Click()

    Dim bFile() As Byte ' Retrieving a binary file.

    bFile() = Inet1.OpenURL("http://www.domain.com/program.ext", icByteArray) 'Location of file to download

    Open "saveas.ext" For Binary Access Write As #1 'What/where you want the saved file to be saved. If you put a name w/o a path, it will default to the path the running program is in
    Put #1, , bFile()
    Close #1
    End Sub

    This pulls the file down in the background. Does anyone know how to call the new file after it is downloaded?
    Last edited by DugzDMan; Feb 6th, 2001 at 12:39 AM.

  7. #7
    Guest
    Originally posted by Kzin
    . .any idea about how I can hold the execution of the next lines until the download has occurred?

    Try adding the DoEvents function.
    Also, you don't have to have it tell you if the download was successful or not.


    Code:
    DownloadFile "http://www.vb-world.net", "c:\vbworld.htm"

    But if you do want it to tell you...


    Code:
    Dim Dl As Boolean
    Dl = DownloadFile("http://www.vb-world.net", "c:\vbworld.htm") 
    If Dl = True Then
        Msgbox "Download complete"
    Else
        Msgbox "An error occured when downloading the file.", 16
    End If

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