最简单的从服务器下载文件的VB代码

原创 小姚  2021-11-12 23:08  阅读 36 次

第一种方法:后台下载

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

最简单的从服务器下载文件的VB代码-小姚工作室

本文地址:https://www.xiaoyaogzs.com/3865.html
关注我们:请关注一下我们的微信公众号:扫描二维码小姚工作室的公众号,公众号:小姚户外
版权声明:本文为原创文章,版权归 小姚 所有,欢迎分享本文,转载请保留出处!
NEXT:已经是最新一篇了

发表评论


表情