URLDownloadToFile & progressbar


Anyone know how to implement a progressbar with the URLDownloadToFile call??

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pritaeasSoftware EngineerCommented:
Hi. That function does not support it. Have a look at the other functions in the WinINet API: InternetRead especially. You can use it to read in a block of data, thus enabling a way to control a progressbar since you know how much is coming in at a time. With InternetQuery(... something) you can ask the filesize. Don't have the code with me here, but if you send me an e-mail I'll try to find it in my backups and sent it to you.

hth, pritaeas
rynosterAuthor Commented:
One of the parameters in the URLDownloadToFile function is, IBindStatusCallBack, which, according to MS is a way to control a progress bar. I just don't know how!!

I'll send you an email anyway.

A client requesting an asynchronous bind operation must provide a notification object exposing the IBindStatusCallback interface. The asynchronous moniker provides information on the bind operation to the client by calling notification methods on the client's IBindStatusCallback interface. This interface also allows the client to pass additional bind information to the moniker by calling the IBindStatusCallback::GetBindInfo and IBindStatusCallback::GetPriority methods after receiving a call from IMoniker::BindToObject or IMoniker::BindToStorage .

IBindStatusCallback Members

GetBindInfo Provides information about how the bind operation should be handled when called by an asynchronous moniker.
GetPriority Obtains the priority for the bind operation when called by an asynchronous moniker.
OnDataAvailable Provides data to the client as it becomes available during asynchronous bind operations.
OnLowResource Not currently implemented.
OnObjectAvailable Passes the requested object interface pointer to the client.
OnProgress Indicates the progress of the bind operation.
OnStartBinding Notifies the client about the callback methods it is registered to receive. This notification is a response to the flags the client requested in the RegisterBindStatusCallback function.
OnStopBinding Indicates the end of the bind operation.

IBindStatusCallback::OnProgress Method


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.
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

rynosterAuthor Commented:

Thanks for the reply.
This is all very useful info, but I still don't know how to implement with the URLDownloadToFile function...

You need to write a component(object) with IBindStatusCallBack interface.
And give the interface to URLDownloadToFile.
If I'm not mistaken you'll get notifications to the component(object).
rynosterAuthor Commented:
Any ideas on how to do this??

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rynoster, didn't I help you? You think that I've not earned some points?
rynosterAuthor Commented:
Hey Gloomyfair.

Thanx for all ur comments, and, not 2 b rude or anything, but it didn't help me much.

But don't worry, there's always a next time.

Thanx to Geo for helping me!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.