![]() |
|
Tipp 0538
|
Datei-Download mit Dialog und ProgressBar
|
 |
|
Autor/Einsender: Datum: |
|
Lothar Kriegerow 22.10.2007 |
|
| Entwicklungsumgebung: |
|
VB 6 |
|
|
| Der Download einer Datei aus dem Internet kann auf
unterschiedliche Arten realisiert werden. Die einfachste und
sogleich komfortabelste Möglichkeit bietet die Verwendung der
API-Funktion DoFileDownload des Internet-Explorers. |
|
Diese Funktion stellt nicht nur den Speichern-Dialog zur Verfügung,
sondern zeigt auch noch die bekannte Fortschrittsleiste, und das mit
nur knapp 5 Zeilen Programm-Code. Damit die Datei auch erfolgreich downgeloadet werden kann, muss
der übergebene String nicht nur den kompletten
Http-Pfad enthalten, sondern er muss mittels StrConv
zusätzlich noch in einen Unicode-String konvertiert werden.
|
|
| |
Option Explicit
Private Declare Function DoFileDownload Lib "shdocvw.dll" (ByVal _
lpszFile As String) As Long
Private Sub cmdDownload_Click()
Dim strURL As String
Dim strDatei As String
strDatei = txtURL.Text
strURL = StrConv(strDatei, vbUnicode)
DoFileDownload strURL
End Sub
Private Sub Form_Load()
txtURL.Text = _
"http://home.arcor.de/lotharkriegerow/download/MSSQL_Hilfe.chm"
End Sub
|
|
|
|
|
|
|
|
|
|
Um diesen Tipp ausführen zu können, muss der Microsoft
Internet Explorer 4.0 oder höher auf dem System installiert
sein.
|
|
| Windows-Version |
| 95 |
 |
|
| 98 |
 |
|
| ME |
 |
|
| NT |
 |
|
| 2000 |
 |
|
| XP |
 |
|
| Vista |
 |
|
| Win
7 |
 |
|
|
| VB-Version |
| VBA 5 |
 |
|
| VBA 6 |
 |
|
| VB 4/16 |
 |
|
| VB 4/32 |
 |
|
| VB 5 |
 |
|
| VB 6 |
 |
|
|
|
Download (32,8
kB)
|
Downloads bisher: [ 543 ]
|
|
|