Datei aus dem Internet downloaden

URLDownloadToFile
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
Function DownloadFile(ByVal sUrlFile, ByVal sLocalFile As String) As Boolean
Dim lResult As Long
  lResult = URLDownloadToFile(0, sUrlFile, sLocalFile, 0, 0)
  If lResult = 0 Then DownloadFile = True Else DownloadFile = False
End Function
Sub Command1_Click()
'Syntax:
'DownloadFile [URLFILE], [ZIEL]
  Call DownloadFile("http://www.webseite.com/sitemap.htm", "C:\kopie.htm")
End Sub
 
'oder Quelle & Ziel aus Textboxen lesen und Download mit Button starten:
Sub Command1_Click()
Dim x$, y$
  x = Text1.Text
  y = Text2.Text
  Call DownloadFile(x, y)
End Sub
'Probleme: beim Download von großen Dateien blockiert das Formular.
'Und: wenn Internet-Verbindung unterbrochen wird, bricht Download ab...
'Dann besser einen Download-Manager verwenden.

 Ranking-Hits zurück Sitemap
Designed by www.wbrnet.info