Sub test() ??? Dim H, S ??? Set H = CreateObject("Microsoft.XMLHTTP") ??? H.Open "GET", http://www.163.com/test.exe, False?? '文件網(wǎng)址 ??? H.send??? ??? Set S = CreateObject("ADODB.Stream") ??? S.Type = 1 '二進(jìn)制 ??? S.Open ??? S.write H.Responsebody '寫入取得的內(nèi)容 ??? S.savetofile "c:\temp\test.exe", 2? '保存文檔 ??? S.Close End Sub Sub test2() Dim bt() as byte '建立數(shù)組 Dim H As Object ??? Set H = CreateObject("Microsoft.XMLHTTP") ??? H.Open "GET", "Http://www.163.com/test.exe", False ??? H.send ??? If H.Status = 200 Then '沒有超時(shí) bt = H.Responsebody ??????? Open "http://www.163.com\test.exe" For Binary As #1 '建立二進(jìn)制文件 ??????? Put 1, , bt '寫入文件 ??????? Close #1 ??? End If End Sub? 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 '申明API
Sub downlaod() URLDownloadToFile 0, "End Sub
|
新跟帖 (共1 條評(píng)論)
查看更多評(píng)論。。。