【#文档大全网# 导语】以下是®文档大全网的小编为您整理的《最简单的从服务器下载文件的VB代码》,欢迎阅读!

第一种方法:后台下载
Private Declare Function URLDownloadToFile Lib "urlmon.dll" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Private Sub Command1_Click()
URLDownloadToFile 0, "http://192.168.1.101/hbwl.rar", "c:\hbwl.rar", 0, 0 End Sub
第二种方法:文件另存为
Private Declare Function DoFileDownload Lib "shdocvw.dll" (ByVal lpszFile As String) As Long
Private Sub Command1_Click() Dim gourl As String
gourl = StrConv("http://192.168.1.101/hbwl.rar", vbUnicode) Call DoFileDownload(gourl) End Sub
本文来源:https://www.wddqxz.cn/bba3de205022aaea988f0f0a.html