Download an Exe from the web?

So, I am trying to just download a simple executable from the web, in specific MediaFire. The problem is all I can find on downloading files is UrlDownloadToFile(), even if I could get this to work, I hear it doesn't wait for the file to download completely, which is a problem for me... I don't want to use a library such as LibCurl or something. I did have a program which did exactly this, about 4 months ago. I deleted it by mistake and when I came back to look for it, I found I deleted it, and Recuva can't find it... So can someone point me to where I can download a file in C++, or just show me a solution to make UrlDownloadToFile() wait for the file to download...

Thanks.
From what I just read (never used UrlDownloadToFile() befre), that function should download the whole file. Looks like it uses a callback to signal that the file has been downloaded completely.

Why are you so against using a library?
Could you point me to the article you read?

I just don't like using them, all the linking and everything is not worth the bulk it will add to the project. If I have to use one though, I know how to link them.

EDIT::
By bulk, besides all the extra headers and stuff it adds, I also mean, why would I use LibCurl, a huge library full of things I won't use. All I need is to download a file, and LibCurl has so many more things then that, why download it for one out of hundreds of functions?
Last edited on
Learning how to use a 3rd party library is a necessary skill of any developer.

I just read it at MSDN: http://msdn.microsoft.com/en-us/library/ie/ms775123(v=vs.85).aspx
... I hear it doesn't wait for the file to download completely

Who told you that? The download progress is reported to you by the "OnProgress()" method from the IBindStatusCallback Interface you pass this function as the fifth argument. What is the issue that you are having with this function?
Learning how to use a 3rd party library is a necessary skill of any developer.

I just read it at MSDN: http://msdn.microsoft.com/en-us/library/ie/ms775123(v=vs.85).aspx


I know how to use them, they just add more than I will ever use (Most of them that is). I have used, and enjoyed using SFML.

And Thank you for the article

Who told you that?


I thought I read it in a StackOverflow article, I may be mistaken though... Thank you for clarifying it though!

Last edited on
I don't understand IBindStatusCallback, article anyone? MSDN offered nothing on how to create one, or what it is.
Downloading from file sharing sites like mediafire.com means you need to get session cookies from original HTML page, parse the response and possibly find unique download link there (at least for free accounts).

URLDownloadToFile has no way of doing this, so it's more or less useless. libcurl will do an excellent job here.

Of course, if you don't want external libraries (to me that means 'don't know how to use it :)' ) there is an option to use winsock, WinHTTP or WinInet APIs instead.

... I hear it doesn't wait for the file to download completely


That's true, if you don't use IBindStatusCallback and pass NULL instead it will work asyncronuously.
Topic archived. No new replies allowed.