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
用法:
1 2 3 4 5 6 7 8 9
Private Sub test() Dim v_URL As String, v_FileName As String, v_Result As Long v_URL = "http://www.baidu.com/img/baidu_logo.gif" v_FileName = App.Path & "\Baidu.bmp" '下载百度Logo图片 v_Result = URLDownloadToFile(0, v_URL, v_FileName, 0, 0) '下载文件,返回 0 表示成功 v_URL = "http://www.baidu.com" v_FileName = App.Path & "\Baidu.html" '下载百度首页的网页 v_Result = URLDownloadToFile(0, v_URL, v_FileName, 0, 0) '下载文件,返回 0 表示成功 End Sub