Главная страница
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.017 c
3-70099
chegevara
2003-04-29 14:56
2003.05.22
xml или ...


1-70273
KSergey
2003-05-12 15:39
2003.05.22
Как бы выудить версию программы из свойств проекта?


7-70553
Ash
2003-03-24 09:36
2003.05.22
Встраивание приложения


1-70365
Rocker
2003-05-10 07:25
2003.05.22
Случайный выбор


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