|
-
Nov 10th, 2000, 07:55 AM
#1
How do i download a file from the internet?
What i want to do is to make a program to download 'Free program of the day' from my site which i am thinking to create later.
-
Nov 10th, 2000, 09:01 AM
#2
Fanatic Member
Use the Inet Control (MSINET.OCX)
Code:
Private Sub DownloadFile(ByVal URL as String, ByVal LocalFile as String)
Dim b() as Byte
Open LocalFile for Binary As #1
b() = Inet1.OpenURL(URL, icByteArray)
Put #1, , b()
Close #1
End Sub
Private Sub cmdGetUpdate_Click()
DownloadFile "http://free.digitalriver.com/pub/strata3/strata3d.zip", "C:\strata3d.zip"
End Sub
This will downlaod a pretty cool program. enjoy
r0ach™
Don't forget to rate the post
-
Nov 10th, 2000, 09:56 AM
#3
Frenzied Member
If you don't need that much costumization but a reliable method I suggest using the API.
http://www.vb-world.net/internet/tip501.html
and if you need a dialog (with the progress/speed and stuff, just the general download-dialog used in IE
Code:
'[begin of code]
'Author: Brad Martinez
'Origin: http://www.mvps.org/vbnet/code/netwo...ledownload.htm
'Purpose: Download a file via the file-download dialog
'Version: VB5+
Option Explicit
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright ©1996-2000 VBnet, Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' You are free to use this code within your own applications,
' but you are expressly forbidden from selling or otherwise
' distributing this source code without prior written consent.
' This includes both posting free demo projects made from this
' code as well as reproducing the code in text or html format.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Declare Function DoFileDownload Lib "shdocvw.dll" (ByVal lpszFile As String) As Long
Private Sub DownloadFile(Url As String)
Url = StrConv(Url, vbUnicode)
Call DoFileDownload(Url)
End Sub
'[end of code]
Have fun!!!
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Nov 12th, 2000, 07:03 AM
#4
Thank you both. That was a great help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|