Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URLDOWNTOFILE, processbar?

Status
Not open for further replies.

flintstone42

Programmer
Aug 7, 2001
52
US
Hi:
I have using the urldownloadtofile api function for
sometime to download webpages

DECLARE LONG URLDownloadToFile IN URLMON.DLL ;
LONG, STRING, STRING, LONG, LONG

lnGetResults = URLDownloadToFile(0, url, localfile, 0, 0)

I have been using this for webservices with support the
http get funtion and putting the data inside the url
"
This works well except when the web service is down.

Then, the computer will seem to lockup for 3-5 minutes
before return an error code.
(Since the web service usually returns a value in
less then 2 seconds ).

This there a way to show a progress bar
(with a cancel button) for this function using foxpro?

The last value , is IBindStatusCallback
You are suppose to pass an object which handles the
interface (0 means no interface).
How do you do this in VFP (have found a few example in c++)?
 
VFP does not support callbacks, so there is really no easy way to do what you want it to do. Alternative, though this would require that you changed your code would be to use something such as the following:

Add Download Ability to Your App in 2 Seconds
faq184-3838

Slighthaze = NULL
[sub]craig1442@mchsi.com[/sub][sup]
"Whom computers would destroy, they must first drive mad." - Anon​
[/sup]
 
You may want to also explore InternetOpen, InternetSetOption (options INTERNET_OPTION_CONNECT_TIMEOUT & INTERNET_OPTION_CONNECT_RETRIES), InternetOpenUrl and InternetReadFile...
 
Your dofiledownload in FAQ184-3838
requires shdocvw.dll , which I do not have.

as for INTERNET_OPTION_CONNECT_TIMEOUT
Micrsoft says that InternetSetOption will not
work wil IE 5.0 (and higher?)
176420 InternetSetOption Does Not Set Timeout Values

1. How do I set the timeout value?

2. Since this is a Internet Exploer function,
I will have to set it back afterward
(In fact, the user may have IE will doing this)

3. If I give URLDOWNLOADTOFILE a bad url,
it comes back almost immediately with an error,
Only when URL is valid but the server is slow or down
do I have this problem.

Any Ideas?
 
Looks kinda hairy, though: Probably would need a C++ dll intermediary to handle the threads...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top