var
F: File;
i: integer;
begin
for i := 0 to (FileListBox1.Items.Count - 1)do
begin
try
if FileListBox1.Selected then
begin
if not FileExists(FileListBox1.Items.Strings) then
begin
MessageDlg('File: ' + FileListBox1.Items.Strings +
' not found', mtError, [mbOk], 0);
Continue;
end;
AssignFile(F, FileListBox1.Items.Strings);
Reset(F, 1);
ListBox1.Items.Add(IntToStr(FileSize(F)));
CloseFile(F);
end;
finally
{do
something here }
end;
end;
end;
这就是帮助中的例子,不用讨厌.