Ich mache es haargenau gleich wie LTE5
Delphi-Quellcode:
class function TFileHelper.GetSize(
const fileName:
String): Int64;
var
info: TWin32FileAttributeData;
begin
if not TFile.Exists(fileName)
then
raise EFileNotFoundException.CreateRes(@SFileNotFound);
// Quelle: http://stackoverflow.com/a/1642355/2298252
if not GetFileAttributesEx(
PChar(fileName),
WinApi.Windows.GetFileExInfoStandard,
Addr(info)
)
then RaiseLastOSError();
Result := Int64(info.nFileSizeLow)
or Int64(info.nFileSizeHigh
shl 32);
end;