Вниз
Скачать: 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 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.009 c
14-70484
Fennek^Red
2003-05-01 19:28
2003.05.22
Две винды


14-70445
4you
2003-05-02 11:04
2003.05.22
Новые библиотеки


3-70163
_Narayan_
2003-05-02 14:05
2003.05.22
триггер


7-70547
mmmh
2003-03-24 22:24
2003.05.22
Подскажите как извлеч файл из архива который запоролен. То есть


14-70427
Alexandr3
2003-05-01 18:24
2003.05.22
Code insight




   Наверх