Bosanac
asked on
progress bar
How can I activate progress bar while deleting file?
For a nicer look,he,he....
For a nicer look,he,he....
Still it is necessary to make Application.ProcessMessage s after string(line) " Possition: = i "
Use the Win API call, SHFileOperation, which will copy, remove, delete and rename files and show the standard Windows dialog box at the same time.
J.
J.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hi jsweby
Good suggestion. I have used SHFileOperation on occasions but the problem I have had with it is that when it comes across a file that causes a sharing violation the process completely stops at that point and won't resume on its own. Do you have Any ideas how to get pass this problem? Thanks :>)
Good suggestion. I have used SHFileOperation on occasions but the problem I have had with it is that when it comes across a file that causes a sharing violation the process completely stops at that point and won't resume on its own. Do you have Any ideas how to get pass this problem? Thanks :>)
To tell you the truth, no, I wasn't aware of this problem and have no resolution for it. Windows is the same though, if you're copying files and there is a sharing violation error message, the copy stops, it doesn't resume, so I guess in that respect you're emulating Windows perfectly, ideally or not.
J.
J.
Thanks J
Perhaps Windows uses the same function hence the emulation affect.
Perhaps Windows uses the same function hence the emulation affect.
Windows does use this exact function for its file operations, it is a direct call to the same Windows API command.
ASKER
T! and to rest...
procedure TForm1.Button1Click(Sender
var
i: Integer;
const
sFilesToDel: array[1..4] of string = ('C:\File.0', 'C:\File.1', 'C:\File.2', 'C:\File.3');
begin
with ProgressBar1 do begin
Min := 0;
Max := High(sFilesToDel);
Position := Min ;
for i := Low(sFilesToDel) to High(sFilesToDel) do begin
DeleteFile(sFilesToDel[i])
Position := i;
end;
end;
end;
The Crazy One