请教 VB6.0网络编程问题
假设网站 www.baidu.com 下面有个 a.exe 的文件,我想用VB6.0去下载这个 a.exe 怎么实现?
我是新手,有代码最好。我的邮箱是gxming1981@yahoo.com.cn
[解决办法]
Private Sub Command1_Click()Dim URL As StringURL = "http://www.cctv.com/Library/homepage2009/img/BSD.jpg" Dim file() As Byte file() = Inet1.OpenURL(URL, icByteArray) Open "C:\1.jpg" For Binary Access Write As #1 Put #1, , file() Close #1 MsgBox "Success" End Sub
[解决办法]
Option Explicit
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 '-下载文件
Private Sub Command1_Click()
URLDownloadToFile 0, "http://www.baidu.com/a.exe", "C:\a.exe", 0, 0
End Sub