-
Apr 30th, 2005, 04:23 AM
#1
Thread Starter
Lively Member
Download Program [RESOLVED]
HELLO AGAIN
I have a form two text boxes and a command button
The user enters the url for a download into one text box and then the dir they want it to go to on their own machine
When they press the command button the program should download but it i dont know the code for this problem.
Hopefully one of you can help me
Last edited by Aaron Smith; Apr 30th, 2005 at 05:16 AM.
Regards
Aaron Smith
Did my post help you, rate my post
When Quoting VB Code use [vbcode][/vbcode]
When your problem has been resolved change to *subject* [RESOLVED]
-
Apr 30th, 2005, 04:48 AM
#2
Re: Download Program
You could try the URLDownloadToFile API function. I've made a simple wrapper sub around it. Simply call DownloadFile with the URL and the name and path of the local file.
VB Code:
Private Declare Sub URLDownloadToFile _
Lib "URLMON.dll" ( _
ByVal lpCaller As Long, _
ByVal szUrl As String, _
ByVal szFilename As String, _
ByVal dwReserved As Long, _
ByVal lpBindStatusCallback As Long)
Public Sub DownloadFile(ByVal sUrl As String, ByVal sLocalFile As String)
URLDownloadToFile 0, sUrl, sLocalFile, 0, 0
End Sub
-
Apr 30th, 2005, 04:52 AM
#3
Thread Starter
Lively Member
Re: Download Program
Jocain thanks for replying but
Originally Posted by Joacim Andersson
You could try the URLDownloadToFile API function. I've made a simple wrapper sub around it. Simply call DownloadFile with the URL and the name and path of the local file.
I have no idea wot that means or wot i have to do with my form and the code
Regards
Aaron Smith
Did my post help you, rate my post
When Quoting VB Code use [vbcode][/vbcode]
When your problem has been resolved change to *subject* [RESOLVED]
-
Apr 30th, 2005, 05:09 AM
#4
Re: Download Program
Copy and paste the above code to the form. In the Click event of your button you call the DownloadFile sub:
VB Code:
Private Sub Command1_Click()
Call DownloadFile([i]UrlToFile[/i], [i]LocalFileName[/i])
End Sub
-
Apr 30th, 2005, 05:16 AM
#5
Thread Starter
Lively Member
Re: Download Program
thanks jocain i have made the program now
Regards
Aaron
Regards
Aaron Smith
Did my post help you, rate my post
When Quoting VB Code use [vbcode][/vbcode]
When your problem has been resolved change to *subject* [RESOLVED]
-
Apr 30th, 2005, 02:53 PM
#6
Re: Download Program [RESOLVED]
Joacim.
I can't get this code to work. I get an error Can't find DLL entry point URLDownloadToFile in URLMON.DLL
VB Code:
Private Sub Command1_Click()
Call DownloadFile("http://www.martin2k.co.uk/forums/index.php?act=Attach&type=post&id=511", "c:\temp\regclean.zip")
End Sub
Am I coding it right?
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
Apr 30th, 2005, 04:04 PM
#7
Member
Re: Download Program [RESOLVED]
I get the same error =D
EDIT: Here's an inet example that works: http://www.vbforums.com/showthread.p...load+file+inet
Last edited by Menekali; Apr 30th, 2005 at 04:09 PM.
-
Apr 30th, 2005, 04:38 PM
#8
Re: Download Program [RESOLVED]
Yes I've tried that progress.zip and it works. I just wondered why Joacim posted that code if it doesn't work, as he tried it. I wonder what Aaron is using now its resolved.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
Apr 30th, 2005, 08:08 PM
#9
Re: Download Program [RESOLVED]
Sorry chaps Please let me know what you haven't got working. I'm more then willing to help you out if you need any 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
|