Dim b() As Byte
Dim strPath As String
Inet2.URL = "http://www.office-cn.net/test.jpg"
strPath = App.Path & "/tmp.bmp"
b() = Inet2.OpenURL(, icByteArray)
Open strPath For Binary Access Write As #1
Put #1, , b()
Close #1作者: fan0217 时间: 2008-3-18 17:57
Public Sub SaveWebPicture(url As String, fileName As String)
作者: tmtony 时间: 2008-3-18 18:08
呵呵, 用stream也是好办法作者: lixun005 时间: 2008-3-18 23:00
非常感谢两位,哈哈......作者: lixun005 时间: 2008-3-19 11:08
请问一下加在铵钮上是这样用的吗?
需要加插件吗?
Private Sub Command0_Click()
Public Sub SaveWebPicture(url As String, fileName As String)
Dim x As New XMLHTTP
Dim s As New ADODB.Stream
x.Open "GET", url, False
x.send
s.Type = 1
s.Open
s.Write x.responseBody
s.SaveToFile fileName
s.Close
Set x = Nothing
Set s = Nothing
End Sub
SaveWebPicture "http://cimg2.163.com/mobile/2008/3/18/160_129.jpg", "D:\Test.jpg"
End Sub
End Sub作者: fan0217 时间: 2008-3-19 13:42
需要引用xml和ado2.5以上版本作者: lixun005 时间: 2008-3-19 14:31
Public Sub SaveWebPicture(url As String, fileName As String)
Dim x As New XMLHTTP
Dim s As New ADODB.Stream
x.Open "GET", url, False
x.send
s.Type = 1
s.Open
s.Write x.responseBody
s.SaveToFile fileName
s.Close
Set x = Nothing
Set s = Nothing
End Sub
Private Sub Command0_Click()
SaveWebPicture "http://cimg2.163.com/mobile/2008/3/18/160_129.jpg", "D:\Test.jpg"
End Sub
提示
Dim x As New XMLHTTP
Dim s As New ADODB.Stream
错误