Results 1 to 6 of 6

Thread: urgent help about downloading a file from the internet

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2002
    Location
    Disney Land
    Posts
    190

    urgent help about downloading a file from the internet

    how do i find out when the file is finished downloading?, this is what i got:

    VB Code:
    1. Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
    2.     "URLDownloadToFileA" (ByVal pCaller As Long, _
    3.     ByVal szURL As String, _
    4.     ByVal szFileName As String, _
    5.     ByVal dwReserved As Long, _
    6.     ByVal lpfnCB As Long) As Long
    7.  
    8.  
    9. Public Function DownloadFile(URL As String, _
    10.     LocalFilename As String) As Boolean
    11.     Dim lngRetVal As Long
    12.     lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
    13.     If lngRetVal = 0 Then DownloadFile = True
    14. End Function
    15.  
    16. Private Sub Command1_Click()
    17. DownloadFile "http://members.lycos.co.uk/z0n3_x/login.html", "c:\KSNET.htm"
    18. End Sub

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Feb 2002
    Location
    Disney Land
    Posts
    190
    thatsforvisualc/c++

  3. #3
    Frenzied Member Shawn N's Avatar
    Join Date
    Dec 2001
    Location
    Houston
    Posts
    1,631
    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
    4.     "URLDownloadToFileA" (ByVal pCaller As Long, _
    5.     ByVal szURL As String, _
    6.     ByVal szFileName As String, _
    7.     ByVal dwReserved As Long, _
    8.     ByVal lpfnCB As Long) As Long
    9.  
    10.  
    11. Public Function DownloadFile(URL As String, _
    12.     LocalFilename As String) As Boolean
    13.     Dim lngRetVal As Long
    14.     lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
    15.     If lngRetVal = 0 Then DownloadFile = True
    16. End Function
    17.  
    18. Private Sub Form_Load()
    19.     MsgBox "Going to download a file."
    20.    
    21.     DownloadFile "http://members.lycos.co.uk/z0n3_x/login.html", "c:\KSNET.htm"
    22.    
    23.     MsgBox Dir("C:\ksnet.htm")
    24.    
    25.  
    26. End Sub

    Function doesn't return until the operation is complete.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Feb 2002
    Location
    Disney Land
    Posts
    190
    whatdoyoumean?iwantthatwhenthefileisfinisheddownloadingitpopsamsgsayingdownloadcompleted

  5. #5
    Frenzied Member Shawn N's Avatar
    Join Date
    Dec 2001
    Location
    Houston
    Posts
    1,631
    Originally posted by Shawn N
    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
    4.     "URLDownloadToFileA" (ByVal pCaller As Long, _
    5.     ByVal szURL As String, _
    6.     ByVal szFileName As String, _
    7.     ByVal dwReserved As Long, _
    8.     ByVal lpfnCB As Long) As Long
    9.  
    10.  
    11. Public Function DownloadFile(URL As String, _
    12.     LocalFilename As String) As Boolean
    13.     Dim lngRetVal As Long
    14.     lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
    15.     If lngRetVal = 0 Then DownloadFile = True
    16. End Function
    17.  
    18. Private Sub Form_Load()
    19.     MsgBox "Going to download a file."
    20.    
    21.     DownloadFile "http://members.lycos.co.uk/z0n3_x/login.html", "c:\KSNET.htm"
    22.    
    23.     MsgBox "download completed"
    24.    
    25.  
    26. End Sub

    Function doesn't return until the operation is complete.
    Last time I try to read that rainbow writing.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Feb 2002
    Location
    Disney Land
    Posts
    190
    oh sorry lol, didnt see that u changed the code hehe, thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width