Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2003.05.22;
Скачать: CL | DM;

Вниз

Как получить размер файла в байтах?   Найти похожие ветки 

 
Lamerr ©   (2003-05-09 10:56) [0]

Собственно, сабж.
Нашел GetFileSize, но туда надо передавать дескриптор, который надо еще получить...
Нет ли способа попроще?


 
Lamerr ©   (2003-05-09 11:33) [1]

Кажется, выкрутился...
Вопрос снимается.


 
german goering   (2003-05-09 11:41) [2]

Два способа:

procedure TForm1.Button1Click(Sender: TObject);
var hFile: Cardinal;
Size: Cardinal;
begin
with TOpenDialog.Create(Self) do
try
if Execute then
begin
hFile := FileOpen(FileName,fmOpenRead);
try
Size := GetFileSize(hFile,nil);
ShowMessage("Filesize of """ + FileName + """ is " + IntToStr(Size) + " bytes");
finally
FileClose(hFile);
end;
end;
finally
Free;
end;
end;

procedure TForm1.Button2Click(Sender: TObject);
var SearchRec: TSearchRec;
begin
with TOpenDialog.Create(Self) do
try
if Execute then
try
if FindFirst(FileName,faAnyFile,SearchRec) = 0
then
ShowMessage("Filesize of """ + FileName + """ is " + IntToStr(SearchRec.Size) + " bytes");
finally
FindClose(SearchRec);
end;
finally
Free;
end;
end;

?


 
Lamerr ©   (2003-05-09 11:50) [3]

Спасибо, буду иметь в виду.



Страницы: 1 вся ветка

Текущий архив: 2003.05.22;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.012 c
11-70197
Avenger__
2002-08-14 01:57
2003.05.22
баг


14-70516
antonn
2003-05-04 05:49
2003.05.22
MMTools


14-70458
Supreme 2
2003-05-01 10:19
2003.05.22
Очень запутанная ситуация. Нужна помощь.


1-70205
Knight
2003-05-07 23:00
2003.05.22
Печать с канвы на принтер


1-70217
Ш-К
2003-05-11 02:11
2003.05.22
Действие по расписанию.