If I want to download a file from the internet, What controls do I use and please post the code to use with them.
If I want to upload afile from the internet, What controls do I use and please post the code to use with them.
Printable View
If I want to download a file from the internet, What controls do I use and please post the code to use with them.
If I want to upload afile from the internet, What controls do I use and please post the code to use with them.
To download a file from the Internet with IE, use the DoFileDownload api function:
Code:Private Declare Function DoFileDownload _
Lib "shdocvw.dll" (ByVal lpszFile As _
String) As Long
Private Sub Command1_Click()
Dim sDownload As String
sDownload = StrConv("http://www.site.com/downloads/file.zip", vbUnicode)
Call DoFileDownload(sDownload)
End Sub
what if I want it to download a file without anyone seing that stupid window!
You can use the URLDownloadToFile api function to do this.
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
Public 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
Usage
MsgBox DownloadFile("http://www.vb-world.net", "c:\vbworld.htm")
DId you have this problem use the recommended coding for background downloading file from internet to local drive.
Error message as follow:-
" can't find DLL entry point URLdownloadtofile in urlmon"
Anyone have similar problom and how to solve it.
My operating system is windows2000, did this windows related problem?
Thanks