-
I tried both method and a big problem I had was that they always seemed to put everything I downloaded into the cach and use that cached file. When I changed the version of the file on the net for testing purpose, it always "sent" me the old one. Took me some time to realise that since I thought my code was buggy.
So anyone know how to prevent it from using the cache? I guess I could delete the files directly from the cache but that's a pain.
-
Did you get the URLDownloadToFile to work? Because it won't work for me.
And Inet, you can tell it where to download on your computer.
-
Matthew, doesn't it work for you? Wich OS? Wich IE? Which... ehrr....
this works for me:
Code:
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 Function DownloadFile(URL As String, _
LocalFilename As String) As Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
End Function
Private Sub Form_Load()
DownloadFile "http://vbaccelerator.com", "c:\test.txt"
End Sub
-
IE 5.5, Win98 SE
Maybe I'm doing something wrong.
Let me try it again....
Nope, now it won't even work, just freezes.
-
Strange man :(
It's ok it freezes, it does for me (4 seconds or so), it may take longer depending on your connection speed, it freezes up because it's synchronous, so the app waits till it's finished, before painting the form...
Put the code under a command button and do:
Code:
Private Sub cmdConnect_Click()
MsgBox DownloadFile("http://vbaccelerator.com", "c:\test.txt")
'and just wait for the MsgBox to be displayed... wait lonnggggg if needed :)
End Sub
PS, turn on your ICQ :)
-
I know I can tell it where to download :P
What I mean is that : If you download a 4mb file, it will put it on your HD. Then, if you replace the file on the internet, via FTP with another one and try to redownload, it while give you the first damned file you first downloaded and will "download" in 4 secs or so.
-
I did put it in a Command Button. It told me true the first time when I tried it (not now..2 days ago, I think). And now it won't even do anything, just freezes. Oh wait...it just came up True. Hey! What is up with that? It works. When I save it to the Desktop, it doesn't save. But if I save it to C:\, it works. That's weird.
Dark Rain, you could try using Winsock.
Re: PS: I am on ICQ, I usually am whenever I'm on, just invisible, most of the time.
Thanks Jop, it works :rolleyes:.