|
-
Nov 24th, 2000, 05:06 AM
#1
Thread Starter
Lively Member
I have a small problem with downloading files from the net. I am trying to create an automatic download system from the net that will see if a file exists and then copy it to a particular folder. The problem is that I cannot get the system to copy a file, even if I specify a file which I know exists
Please help!
Cheers
Chris
-
Nov 24th, 2000, 05:17 AM
#2
Lively Member
hi,
try this piece of code
declaration
Public 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
'Code
Private Sub Command1_click()
dim llRetVal as Integer
llRetVal = URLDownloadToFile(0, SourceFileName, _
TargetFileName, 0, 0)
End Sub
if any problem call back this code will download the file on clicking on the command button afte running the example check in ur system it wont pop up any message
-
Nov 24th, 2000, 05:40 AM
#3
PowerPoster
Such a gooc API call.
Wow... that very good API function call. Downlaod a file without using any iNet and webbrowser activex control. I like this function.
-
Nov 24th, 2000, 10:47 AM
#4
Thread Starter
Lively Member
Cheers Krigans, since you seem to be a bit of a guru, any chance you know how to check if a file exists on the web?
Cheers
Chris
-
Nov 24th, 2000, 05:07 PM
#5
To check if a file exists on the internet. You can use the Inet Control to check for the 404 Error.
Code:
Private Sub Command1_Click()
Text1.Text = Inet1.OpenURL("http://www.site.com/site.htm")
DoEvents
If InStr(Text1.Text, "404 Not Found") Then
MsgBox "Site does not exist!"
Else
MsgBox "Site exists!"
End If
End Sub
-
Nov 25th, 2000, 04:30 AM
#6
Lively Member
hi,
thanks chrisfricke,
but no guru and all there's a way for it using wininet.dll but it's a bit lengthy process
as there are lot's of api's and constant declartions
so i will get back to u with the code which u require
within a day or 2
-
Nov 25th, 2000, 04:34 AM
#7
Lively Member
hi Mathew ,
there's problem with inet control is that it works fine but conected to the application twice or thrice ur application will go for a toss
-
Nov 25th, 2000, 04:41 AM
#8
PowerPoster
Downloading status.
Juz found that this API function can not return the downloading status, I mean is the percentage of the entire file being downloaded into the local PC.
Is there anyway to retrieve this information? Because it will a good information to the user.
Originally posted by krigans
hi,
try this piece of code
declaration
Public 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
'Code
Private Sub Command1_click()
dim llRetVal as Integer
llRetVal = URLDownloadToFile(0, SourceFileName, _
TargetFileName, 0, 0)
End Sub
if any problem call back this code will download the file on clicking on the command button afte running the example check in ur system it wont pop up any message
-
Nov 25th, 2000, 04:47 AM
#9
Lively Member
sorry i'm not aware of the method
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|