![]() |
Problem mit Freespace Code
Delphi-Quellcode:
... nur ich komm nicht auf den Code für MB. Es müsste ja eine 1024 wegfallen, nur dann passt %1.2n nicht mehr. Ich komm nicht auf das richtige Format ...
Format(' %1.2n GB', [FCurrentDI.BytesPerSector * FCurrentDI.SectorsPerCluster * (FCurrentDI.NumberOfFreeClusters div 1024) div 1024 / 1024])
Habs mal in %1.3n MB geändert. Wie würde ich den Punkt außer mit Stringreplace entfernen können? |
Re: Problem mit Freespace Code
Delphi-Quellcode:
Ungetested! Aber so sollte es was werden..
Format(' %1.2n GB', [FCurrentDI.BytesPerSector * FCurrentDI.SectorsPerCluster * FCurrentDI.NumberOfFreeClusters / 1024 / 1024 / 1024]);
Wenn Du mir verräts was "FCurrentDI" ist? Verzeichnis ? Datei? Platte? Vielleich hilft das weiter:
Delphi-Quellcode:
function GetFormatedFileSize(FileName: String): String;
var FS : TFilestream; Size: Cardinal; begin Result := FormatFloat('0.00', 0)+' Byte'; try FS := TFileStream.Create(FileName, fmOpenRead + fmShareDenyNone); Size := FS.Size; FS.Free; iTotalSize := iTotalSize + Size; Result := FormatFloat('0.00', Size)+' Byte'; if Size > 10024 then Result := FormatFloat('0.00', Size/1024)+' KB'; if Size > 1000024 then Result := FormatFloat('0.00', Size/1024/1024)+' MB'; if Size > 100000024 then Result := FormatFloat('0.00', Size/1024/1024/1024)+' GB'; except end; end; |
Re: Problem mit Freespace Code
Zitat:
|
Re: Problem mit Freespace Code
Und ich tippe auf ein Record oder eine Klasse. ;)
|
Re: Problem mit Freespace Code
Liste der Anhänge anzeigen (Anzahl: 1)
Sorry, Ich vergaß den Quellcode anzuhängen. Hier ist er ...
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:15 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz