function TamArquivo(Arquivo: string): Integer; begin with TFileStream.Create(Arquivo, fmOpenRead or fmShareExclusive) do try Result := Size; finally Free; end; end;
Solução enviada por Dennis Göhlert (Berlin/German):
function GetFileSize(const szFile: String): Int64; var fFile: THandle; wfd: TWIN32FINDDATA; begin result := 0; if not FileExists(szFile) then exit; fFile := FindFirstfile(pchar(szFile),wfd); if fFile = INVALID_HANDLE_VALUE then exit; result := (wfd.nFileSizeHigh*(MAXDWORD))+wfd.nFileSizeLow; windows.FindClose(fFile); end;