 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Michael Domke Guest
|
Posted: Mon Nov 15, 2004 6:25 pm Post subject: HTTP file transfer |
|
|
Delphi 5 Pro
Indy 9
I am using TIdHTTP.Get to transfer a file from a web server to a client. So
far so good. What I'd like to ultimately accomplish is something similar to
the file transfer UI in IE. That is, to show the progress not only with a
progress bar but also with text (captions) showing totals bytes, bytes
received, etc... Another thing I want is to include a Cancel option (to stop
the process). I am using the OnWork, OnWorkBegin and OnWorkEnd to display
the progress. Unfortunately, in my testing, once the transfer is started, I
can't seem to interact with my application any more. That is, I can't press
a button nor does my captions properly display any updated progress values.
I tried adding Application.ProcessMessages in the OnWork event but that
doesn't seem to help. Does anyone have any suggestions about how I might
accomplish these tasks?
Many thanks,
mbd
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Nov 15, 2004 7:13 pm Post subject: Re: HTTP file transfer |
|
|
"Michael Domke" <mdomke (AT) waymark (DOT) net> wrote
| Quote: | I am using TIdHTTP.Get to transfer a file from a web server to
a client. So far so good. What I'd like to ultimately accomplish is
something similar to the file transfer UI in IE. That is, to show the
progress not only with a progress bar but also with text (captions)
showing totals bytes, bytes received, etc...
|
Use the TIdHTTP's OnWorkBegin, OnWork, and OnWorkEnd events for that.
| Quote: | Another thing I want is to include a Cancel option (to stop the process).
|
The only way to do that is to either disconnect the socket or to throw an
exception from the OnWork event.
| Quote: | Unfortunately, in my testing, once the transfer is started, I can't
seem to interact with my application any more.
|
Then you are not using it properly. Please show your actual code.
| Quote: | That is, I can't press a button nor does my captions properly display
any updated progress values.
|
You are doing the transfer from within the main thread, is that correct? If
so, then the transfer is blocking the main thread from processing new
messages. You need to either 1) drop a TIdAntiFreeze onto the form, or 2)
call Application.ProcessMessages() in your OnWork events.
| Quote: | I tried adding Application.ProcessMessages in the OnWork
event but that doesn't seem to help.
|
Yes, it will, assuming your code is in the main thread to begin with.
Gambit
|
|
| Back to top |
|
 |
Michael Domke Guest
|
Posted: Mon Nov 15, 2004 8:22 pm Post subject: Re: HTTP file transfer |
|
|
| Quote: | That is, I can't press a button nor does my captions properly display
any updated progress values.
You are doing the transfer from within the main thread, is that correct?
If
so, then the transfer is blocking the main thread from processing new
messages. You need to either 1) drop a TIdAntiFreeze onto the form, or 2)
call Application.ProcessMessages() in your OnWork events.
|
Wow, simply dropping a TIdAntiFreeze on the form did the trick. Many thnaks.
I'm new to Indy so I'm not yet aware how all these components are used.
Again, many thanks.
mbd
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|