![]() |
Re: Systeminformation 1.0 - Lite
Es besteht durchaus die Möglichkeit das eine Festplatte nur 56,8 GB Kapazität hat, statt 60 GB - Kommt wegen der seltsamen Umrechnungart der Festplatten hersteller.
geht auch so (Angabe in GB) - mit Format (sollte klappen)
Delphi-Quellcode:
Groesse := FormatFloat('##,##" GB"', Size / 1024 / 1024 / 1024);
|
Re: Systeminformation 1.0 - Lite
Wenn ihr alles immer so kurz wie möglich haben wollt, bitte:
Delphi-Quellcode:
function Formatieren(KB: Extended): String;
const Genauigkeit = 1000; begin if KB >= 0 then result := Floattostr(KB)+ ' ' + 'KiloByte'; if KB > 1023 then result := Floattostr(round((KB / 1024) * Genauigkeit)/Genauigkeit) +' ' + 'MegaByte'; if KB > 1048575 then result := Floattostr(round((KB / 1048576) * Genauigkeit)/Genauigkeit) +' ' + 'GigaByte'; if KB > 1073741823 then result := Floattostr(round((KB / 1073741824) * Genauigkeit)/Genauigkeit) +' ' + 'TeraByte'; if KB > 1099511627775 then result := Floattostr(round((KB / 1099511627776) * Genauigkeit)/Genauigkeit) +' ' + 'PetaByte'; if KB > 1125899906842619 then result := Floattostr(round((KB / 1125899906842620) * Genauigkeit)/Genauigkeit) +' ' + 'ExaByte'; end; |
Re: Systeminformation 1.0 - Lite
Zitat:
|
Re: Systeminformation 1.0 - Lite
Zitat:
Mein Rechner macht so hohe Integer-Variablen nicht mit *g*. Oder hast du einen 256 Bit Integer :shock: ? |
Re: Systeminformation 1.0 - Lite
Ein 64bit Integer (Int64) reicht meineswissen vollständig aus, nehme ich zumindest mal an!
Es gibt ja noch Comp und Real48, falls man kein Int64 hat (wie ich mit Delphi 3) mfG mirage228 |
Re: Systeminformation 1.0 - Lite
Nein, habe ich nicht. Aber hast du eine Festplatte im Terabytebereich? :roll:
Wenn es bis 1000 Gibabyte reicht, dann geht auch das:
Delphi-Quellcode:
@axel: Deine 3309918640128 (ich habe noch mal 1024 genommen, um Byte zubekommen) macht meiner Version anstandslos mit. :wink:
function FormatDiskSpace(DiskSpace: Int64): string;
begin case DiskSpace of 0..1023: result := Format('%d byte', [DiskSpace]); 1024..1048576: result := Format('%2n KB', [DiskSpace / 1024]); 1048577..1073741824: result := Format('%2n MB', [DiskSpace / 1024 / 1024]); else result := Format('%2n GB', [DiskSpace / 1024 / 1024 / 1024]); end; end; Zitat:
|
Re: Systeminformation 1.0 - Lite
Schön... Aber was ist an Extended so schlimm?
Außerdem könnte man ja auch mal größere Datenmengen anzeigen lassen, in einem Netzwerk z.B. |
Re: Systeminformation 1.0 - Lite
Ich glaube, dass Extended langsamer als Integer ist...
bei kleineren Proggis dürfte das aber keine Rolle spielen mfG mirage228 |
Re: Systeminformation 1.0 - Lite
Zitat:
:dp: |
Re: Systeminformation 1.0 - Lite
Zitat:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:18 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-2025 by Thomas Breitkreuz