1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
Private Declare PtrSafe 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 LongPtr
Private Declare PtrSafe Function DeleteUrlCacheEntry Lib "Wininet.dll" Alias "DeleteUrlCacheEntryA" _
(ByVal lpszUrlName As String) As LongPtr
Function U1000_TelechargeFichier(ByVal LienFichierURL As String, _
ByVal LienFichierLocal As String) As Boolean
Dim ReponseAPI As LongPtr
ReponseAPI = URLDownloadToFile(0&, "http://fauconnier.developpez.com/forums/images/densites.png", _
"D:\densites.png", 0&, 0&)
'ReponseAPI = URLDownloadToFile(0&, LienFichierURL, LienFichierLocal, 0&, 0&)
MsgBox Error(ReponseAPI)
If ReponseAPI <> 0 Or Dir(LienFichierLocal, vbDirectory) = vbNullString Then
U1000_TelechargeFichier = False
Else
U1000_TelechargeFichier = True
End If
End Function |
Partager