以下为一个ie的下载api函数,但下载一个文件都会提示下载路径,请教有什么方法可以
在代码中直接写好下载路径
Public Declare Function DoFileDownload Lib "shdocvw.dll" (ByVal lpszFile As String) As Long

解决方案 »

  1.   

    你还不如直接用Winsock控件,根据HTTP协议写下载程序
      

  2.   

    Function FileDownLoad(ByVal ObjInet As Control, ByVal strURL As String, ByVal strSaveFile As String) As Boolean
    '功能:文件下载函数
    'ObjInet:Inet控件
    'strURL:Ftp服务器的地址
    'strSaveFile:下载文件保存地址
    'Designed by Mr.Wangrong
    'QQ :  28830832
    'DATE: 2004-07-01
    On Error GoTo errhandel
    Dim b() As Byte
    Dim StrShell As StringObjInet.AccessType = icUseDefault
    b() = ObjInet.OpenURL(strURL, icByteArray)
       
       Open strSaveFile For Binary Access _
       Write As #1
       Put #1, , b()
       Close #1
       
       If Dir(strSaveFile) <> "" Then
          If MsgBox("Done", vbYesNo, "") = vbYes Then
             StrShell = Shell(strSaveFile, 1)
          Else
             Kill strSaveFile
          End If
      
       Else
       MsgBox "文件不存在"
       End If
    Exit Function
    errhandel:   MsgBox Err.Description
    End Function