One additional comment:
I get acccess violations when closing the app when there are active downloads. - Are you seeing this same result?
Main Topics
Browse All TopicsThis is an extension of this question:
http://www.experts-exchang
and is designed to add cancellation functionality to the download manager that is shown in the previous question.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
ok, I've added the "cancel selected" and the "cancel all" by using the "selected" property of the listview.
during that I am checking the "state" property
I've also added pause/resume to the demo, so others can see how to do that in Indy. (setting the range properties of idhttp1.request)
There aren'e many examples of doing this, so I thought I'd add it.
And I am keeping track of the IdHTTP thread now, so you can see how I am cancelling it in the OnWork event.
I've also used a TActionList for the user commands
The access violations were just because teh indy thread was not being terminated. That has been changed by adding a Destroy method to the object. When the TObjectList frees its' objects, the destroy of each object gets called.
The tricky part is how to get the "filename" of an irregular url
e.g.
http://someserver.com/some
http://someserver.com/down
I think I'll ask a question about that myself :-)
demo is here btw V1.1
https://sourceforge.net/pr
I'll put this code in later, I'm just adding the "get filename from url" code, so don't want to mess with it just yet.
but this is the code you need to clear the top list, remove any temp files, and remove the downloaded file
comment out what you don't need.
double click on the TActionList, add a new action, call it what you like, double click onthe action, and put this code
now, add a TBitBtn (or use the popupmenu) and set the BitBtn or menu item's "action" prperty to your action.
var
i: integer;
s: string;
begin
for i := pred(DownloadableFileList.
begin
// delete the temp files
s := ExtractFilePath(Paramstr(0
if FileExists(S) then
DeleteFile(S);
// delete the complete downloaded file
s := ExtractFilePath(Paramstr(0
if FileExists(S) then
DeleteFile(S);
DownloadableFileList.Delet
// because the download list matches the listview, we can safely assume they have the same index
lvDownloadableFiles.Items[
end;
end;
Loki,
As you seem to be both brilliant at the delphi stuff and willing to tackle big problems, perhaps you might be interested in my latest issue:
http://www.experts-exchang
Hopefully you'll have time to look into it- I fear most people don't have the d2005 platform to work with though it seems you do.
Business Accounts
Answer for Membership
by: hibbidijiPosted on 2006-06-05 at 17:35:37ID: 16838253
I tihnk it would be nice if the file was deleted if the download was cancelled - but this is not a 100% requirement.