How would you enable a progress bar in an ftp transmission? Would it be via InternetRead()... so many bytes to a buffer and write, or get the disk size, calculate and run a side thread counting down as the file comes or goes across?
Posted on 2004-12-26 22:32:06 by drarem
There is a callback that allows you to set a progress bar, you can use the InternetSetStatusCallback and have the callback increment the progress bar as the file is being transferred.
Posted on 2004-12-26 22:44:53 by donkey
thanks
Posted on 2004-12-27 08:37:46 by drarem
This is another part to this question:

what about keeping the GUI responsive? All I need is to let the user know the app is still alive and display progress bar - do I repaint the screen?

Thanks.
Posted on 2004-12-27 14:27:15 by drarem
Not sure how your app is structured, generally when I find that the GUI is unresponsive I run the intensive part in a thread if I think it's going to take a while. Not sure if that would be a good idea for ftp transfers though.
Posted on 2004-12-27 15:00:48 by donkey
thanks for your help, I have the progress bar going - if I don't do anything the progress displays fine, but if I overlay the dialog with another window, eg force a WM_PAINT message in the app, there is a rectangle of white across the face of the dialogbox until the ftp send/receive is done and the progress is no longer displayed (updated).


How can I refresh the views/windows when it gets to the WM_PAINT point? I am using InternetReadFile/WriteFile, sending and receiving chunks of data at a time in a buffer and using the SB_SETPOS for the progress bar.

I tried the other way - using internetsetstatuscallback - can't seem to update the dialog either using it during the transmission. I think it's more of a window repainting issue I need to deal with.

Any suggestions?
Posted on 2004-12-29 16:12:43 by drarem
It sounds like you need a DoEvents type pause that can allow you window to process any messages that might be pending. You might try to PeekMessage when you enter the callback to see if there are any pending WM_PAINT messages then if there are allow the Window to do it's job and wait till it's done.
Posted on 2004-12-29 20:24:35 by donkey