|
Option Explicit
Private Declare Function URLDownloadToFile Lib "urlmon.dll" _
Alias "URLDownloadToFileA" (ByVal pCaller As Long, _
ByVal szURL As String, ByVal szFileName As String, _
ByVal Reserved As Long, ByVal fnCB As Long) As Long
Private Sub Command1_Click()
Dim retVal As Long
If Left(txt_url.Text, 7) <> "http://" Then
MsgBox "Die Url ist nicht oder nur unvollständig angegeben.", _
vbOKOnly + vbInformation, "Fehler"
Exit Sub
ElseIf Len(txt_localfile.Text) < 4 Then
MsgBox "Die Speicher-Adresse ist nicht oder nur " & _
"unvollständig angegeben.", _
vbOKOnly + vbInformation, "Fehler"
Exit Sub
End If
Me.MousePointer = vbHourglass
Command1.Enabled = False
retVal = URLDownloadToFile( _
0, txt_url.Text, txt_localfile.Text, 0, 0)
Me.MousePointer = 99
Command1.Enabled = True
If retVal = 0 Then
MsgBox txt_url.Text & _
" wurde erfolgreich heruntergeladen und als" & _
vbCrLf & txt_localfile & " gespeichert!", _
vbOKOnly + vbInformation, "Download"
Else
MsgBox "Beim Download von " & txt_url.Text & _
" ist ein Fehler aufgetreten !", _
vbOKOnly + vbInformation, "Fehler beim Download"
End If
End Sub
|
|