Examples Delphi

How to get the size of a very large file.
function GetFileSize(const FileName: string): Int64;
var
SizeLow, SizeHigh: DWord;
hFile: THandle;
begin
Result := 0;
hFile := FileOpen(FileName, fmOpenRead);
try
if hFile <> 0 then
begin
SizeLow := Windows.GetFileSize(hFile, @SizeHigh);
Result := (SizeHigh shl 32) + SizeLow;
end;
finally
FileClose(hFile);
end;
end;