Hey guys,
I decided the other day that i wanted to create a simple program that downloads files based on the users specifications. Now what i'm wondering is, what is the most simplest code you can think of that would allow me to download these files? Is this possible to create without having a million or so declarations or any API's?
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
Private Declare Function DeleteUrlCacheEntry Lib "wininet.dll" _
Alias "DeleteUrlCacheEntryA" _
(ByVal lpszUrlName As String) As Long
call it like
vb Code:
'ensure this file does not exist in the cache
Call DeleteUrlCacheEntry(sSourceUrl)
If DownloadFile(sSourceUrl, sLocalFile) Then
'code for successful download
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Sorry guys, i didn't explain it properly. What i'm after is code that can do the same things such as those picture downloaders you can find on the net (Eg, type in a url and all the images/videos/what ever are downloaded from that site)
It doesn't have to be advanced, just the basics will be the way to go. Ultimately i just want a program that can download files from the internet.
So if i went to a random site and i typed in *.html, then all it would download would be the html page.