If I'm downloading a file via URLDownloadToFileA() how can I print something to the screen whilst it is downloading?
If I have something after the function call, it obviously won't run until the function returns.
If I'm downloading a file via URLDownloadToFileA() how can I print something to the screen whilst it is downloading?
If I have something after the function call, it obviously won't run until the function returns.
Open source isn't a matter of life or death......
.......its much more important than that!!
SuSE Linux - GCC 3.4.2
XP Pro - Visual Studio 2005 TS, MinGW 3.4.2
Use threads.Originally Posted by eth0
-- Add Your Signature Here --
If you were thinking of displaying the progress of the download then this function dosen't provide anyway to do that.
That was the plan.
Can you tell me a function which would make life easier?
The idea was to put a spinning bar in the command line to start with, and then maybe try replacing that with percentage figure later.
Open source isn't a matter of life or death......
.......its much more important than that!!
SuSE Linux - GCC 3.4.2
XP Pro - Visual Studio 2005 TS, MinGW 3.4.2
Was the URLDownloadToFile function that you used like this?
If thats the function you used then you can place your code to update the progress in a callback routine and pass it's pointer as the last paramater.Code:HRESULT URLDownloadToFile( LPUNKNOWN pCaller, LPCSTR szURL, LPCSTR szFileName, DWORD dwReserved, LPBINDSTATUSCALLBACK lpfnCB );
I've found URLDownloadToFile to be rather flaky. I've previously posted code that downloads a file to memory using wininet.
As mentioned by Q1024, you can pass a pointer to an IBindStatusCallback COM interface as the last argument to URLDownloadToFile. This is a little more complicated to implement in C (sample here) than C++ (sample here - program 4).