把网络上指定的内容下载到本地指定的路径的代码要怎么写?

来源:百度知道 编辑:UC知道 时间:2024/05/31 04:58:15
把网络上指定的内容下载到本地指定的路径的代码要怎么写?
例如:把http://www.abc.com/abc.rar 下载到 C:\

有进度条的最好!将感激不尽!谢谢!

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

Sub DOWNLOAD(URL As String)
URLDownloadToFile 0, URL, "c:\" & "\123.gif", 0, 0 '下载到c盘并命名为123
End Sub

Private Sub Command1_Click()
DOWNLOAD ("https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/logo-zhidao.gif")
End Sub

用Inet控件。downfile。来使用即可。