Registriert seit: 3. Mai 2003
140 Beiträge
Delphi 2006 Enterprise
|
Re: FileSize bei geöffneten Dateien ?
10. Nov 2003, 19:46
Hallo,
versuchs mal so:
Delphi-Quellcode:
function GetFileSize(const FileName: string): Int64;
var
FileData: TWin32FindData;
FileHandle: THandle;
aFileName: string;
begin
if (AnsiCompareText(FileName, ExtractFileName(FileName)) = 0)
then aFileName := ExpandFileName(FileName)
else aFileName := FileName;
FileHandle := FindFirstFile(PChar(aFileName), FileData);
if (FileHandle <> INVALID_HANDLE_VALUE) then
begin
Result := Int64(FileData.nFileSizeLow)
+ Int64(FileData.nFileSizeHigh) shl (SizeOf(DWORD) * 8);
FindClose(FileHandle);
end else Result := -1;
end;
[edit=Daniel B]Delphi-Tags korrigiert. Mfg, Daniel B[/edit]
"... we know, there are known knowns; there are things we know we know. We also know there are known unknowns; that is to say we know there are some things we don't know. But there are also unknown unknowns - the ones we don't know we don't know."
|