PDA

Click to See Complete Forum and Search --> : Using WebBrowser Object to download files


Kzin
Jan 17th, 2001, 05:10 PM
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 ;)

PJB
Jan 17th, 2001, 05:20 PM
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

Kzin
Jan 17th, 2001, 07:14 PM
Thanks - that looks very promising - I'll try it and tell you what happens! :cool:

Kzin
Jan 18th, 2001, 04:43 AM
. .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?

Kzin
Jan 18th, 2001, 05:08 AM
OK - found the answer -

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

Thanks ;)

DugzDMan
Feb 5th, 2001, 11:24 PM
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?

Feb 6th, 2001, 06:10 AM
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.


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


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


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