请教下各位大侠,我知道怎么用xmlhttp下载文本文档,可是像图片这样的该如何下载呢?
谢啦~

解决方案 »

  1.   

    还有exe文件,请问该如何下载呢?
      

  2.   

    http://dev.csdn.net/article/65285.shtm
      

  3.   

    原来的资源已无法下载,改为下载一个图片:
    '建立一个vb工程,Project1
    '添加引用:scripting runtime,Microsoft ActiveData Object,Microsoft MsXml
    'Form1代码:
     Public a As MSXML2.XMLHTTP
     Private Sub Command1_Click()
       Dim d As Class1
       Set a = New MSXML2.XMLHTTP
       a.open "get", "http://www.hao123.com/images/logox3.gif", True
       Set d = New Class1
       a.onreadystatechange = d
       a.send
    End Sub
    ''Class1代码:
    Dim b As ADODB.Stream
     Dim fso As Scripting.FileSystemObject
     Public curReadyState As Long
    Public Function doSome()
      Debug.Print Form1.a.readyState
      If Form1.a.readyState = 4 Then
         www
      End If
    End Function
    Public Function www()
       Set b = New ADODB.Stream
       b.Type = 1
       b.open
       Set fso = New Scripting.FileSystemObject
       If Form1.a.readyState = 4 Then
            b.Write (Form1.a.responseBody)
            If Not fso.FileExists("c:\mmm.gif") Then
               b.SaveToFile "c:\mmm.gif"
            End If
       End If
       b.Close
       Set b = Nothing
    '
       Set fso = Nothing
    End Function
    '到C盘找图片mmm.gif----实际就百度图标
    ''注意将Class1的doSome设置成default的!方法是
    工具---->过程属性----选doSome---->高级-----过程标识符---->default---确定
    '已经通过测试
      

  4.   

    谢谢啦~
    能再问个问题么?
    WshShell.Run """" & App.Path & """\reg.bat", 0, False这样,运行不了这个bat文件,请问,是怎么回事呢?怎样才能运行呢?
    谢啦~
      

  5.   

    加"""" 干嘛?
    直接WshShell.Run App.Path & "\reg.bat", 0, False试下
      

  6.   

    提示实时错误
    对象‘Run’的方法‘IWshShell3’失败
      

  7.   

    WshShell.Run "cmd /k " & App.Path & "\reg.bat"
      

  8.   

    我测试成功的代码是
    Private Sub Command1_Click()
    Set WshShell = CreateObject("Wscript.Shell")WshShell.Run "cmd /k " & App.Path & "\reg.bat"End Sub