URLDownloadToFile Function in URLMON.DLL

If you call URLDownloadToFile and it takes more than an hour to download a file, the function returns with an error code. Is there a way to set the timeout through the DLL (if needed) to allow for a longer timeout?
LVL 11
Who is Participating?
Richie_SimonettiConnect With a Mentor IT OperationsCommented:
I think it doesn't depends upon dll function. Check your internet options to se if there is an automatic disconnection after pass a hour. If so, function will returns error if download was not completed.
joekendallAuthor Commented:
I'm having the guy check it out. I agree, but I thought I would ask to make sure.


Hi joekendall,

there is a setting to implement, tho i only found some c++ code it's called the onProgress property and from there you should be able to get the progress and eventually the timeout settings

in the wininet control there is a setting for timeouts but it was buggy

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Richie_SimonettiIT OperationsCommented:
The Onprogress depends upon a callback function, if some one has the definition for it...
joekendallAuthor Commented:
Yes, I have looked at the OnProgress callback. I have seen some C++ code myself.

Here is some information on the OnProgress. Anyone have any ideas on how to extract a TimeOut from the OnProgress?

Indicates the progress of the bind operation.


HRESULT OnProgress(          ULONG ulProgress,
    ULONG ulProgressMax,
    ULONG ulStatusCode,
    LPCWSTR szStatusText

[in] Unsigned long integer that contains the current progress of the bind operation relative to the expected maximum indicated in the ulProgressMax parameter.
[in] Unsigned long integer that contains the expected maximum value of the ulProgress parameter for the duration of calls to IBindStatusCallback::OnProgress for this bind operation. Note that this value might change across calls to this method. A value of zero means that the maximum value of ulProgress is unknown (for example, in the IMoniker::BindToStorage method when the data download size is unknown).
[in] Unsigned long integer that receives additional information regarding the progress of the bind operation. This can be any of the BINDSTATUS values.
[in] Address of a string value that contains the textual information indicating the current progress of the bind operation. The text reflects the BINDSTATUS value of the ulStatusCode parameter and is appropriate for display in the user interface of the client.
Return Value

Returns S_OK if successful, or E_INVALIDARG if one or more parameters are invalid.


The moniker calls this method repeatedly to indicate the current progress of the bind operation, typically at reasonable intervals during a lengthy operation.

The client can use the progress notification to provide progress information to the user from the ulProgress, ulProgressMax, and szStatusText parameters, or to make programmatic decisions based on the ulStatusCode parameter.

Client applications that implement the IBindStatusCallback interface can return E_UNIMPL or S_OK if they don't need to receive this notification.
IBindStatusCallback interface is not directly accessible from VB.  It must be altered into a compatible type library.  Eduardo has done this and included the interface in his large OLELib type library w/ sample class showing its use:

joekendallAuthor Commented:
If they up the timeout on the web server, the reports will run. That is not what they did though. They store some information in a DB and poll to see if it is done.


joekendallAuthor Commented:

Please pick up points at http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=visualbasic&qid=20321205 for the additional information you supplied. It was much appreciated.


Richie_SimonettiIT OperationsCommented:
Thanks for "A" grade.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.