Requires VB code for repeating process
Hello Friends
Please help me I am new in developer field & try developing little software I have ( search from net)following code & want to continuous download file after 30 second without Download OK or Error in Download
vb Code:
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
Private Sub Command1_Click()
' Note that this file is 2M, so you might want to try with something simpler
Dim errcode As Long
Dim url As String
Dim localFileName As String
url = "http://mysite.com/data.csv"
localFileName = "c:\data.csv"
errcode = URLDownloadToFile(0, url, localFileName, 0, 0)
If errcode = 0 Then
MsgBox "Download ok"
Else
MsgBox "Error while downloading"
End If
End Sub
Thanks In Advance
Re: Requires VB code for repeating process
I don't fully understand your question. What do you mean by "continuous download file after 30 second"? Do you want to wait 30 seconds? Stop after 30 seconds? And what does "without Download OK or Error in Download" mean? Do you mean you never want to see those messages?
Re: Requires VB code for repeating process
errcode = URLDownloadToFile(0, url, localFileName, 0, 0)
That above line is returning success or failure. If errCode=0 then success.
If you don't want to see the message boxes then remove those lines of code in the snippet you posted. However, you should handle failed downloads: errCode<>0
Here's the official documentation for that API
Re: Requires VB code for repeating process
Quote:
Originally Posted by
MartinLiss
I don't fully understand your question. What do you mean by "continuous download file after 30 second"? Do you want to wait 30 seconds? Stop after 30 seconds? And what does "without Download OK or Error in Download" mean? Do you mean you never want to see those messages?
See Friend
I just want to download a file from web link in continuos time frame. Supose I click start button file get download after that I don't need to click start button process may start atuomatically after 30 second. Get ?
Actually I want to download yahoo delayed stock quote in file on local drive.
Pls Help