就是如何实现用VB调用URLDownloadToFile并显示下载文件的进度。

解决方案 »

  1.   

    'URL Download
    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
    Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
        Dim lngRetVal As Long
        lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
        If lngRetVal = 0 Then DownloadFile = True
    End Function
    Private Sub Form_Load()
    DownloadFile "http://www.XXX.net", "c:\XXX.htm"
    End Sub
      

  2.   

    我的意思是URLDownloadToFile的第四个参数不设为0,而是如何去实现IBindStatusCallback::OnProgress
      

  3.   

    URLDownloadToFile(0, URL, LocalFilename, 参数, AddressOf 子程序或函数)