Autor Beitrag
patrick dee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 311

Win 98SE, WinXP
D3,D6
BeitragVerfasst: Di 05.08.03 06:24 
hi

ich habe mir etwas gebastelt um die größe eines ordners zu erhalten in dem ich wav files zum brennen kopiere. so was mir nun fehlt ist die anzeige wievile MB schon drin sind. das habe ich nun auch hinbekommen allerdings werden fast 12 stellen nach dem komma angezeigt und es würde mir reichen wenn label mir nur zwei hinter dem komma anzeigen würde.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.Timer1Timer(Sender: TObject); // wie groß ist der zielordner
var
 ordnercount : string;
begin
   ordnercount := parameter.Edit1.Text;
    label12.Caption := FloatToStr(GetDirSize(ordnercount, True) /  Sqr(1024))+ ' MBytes größe des Zielordners';
    end;

FRAGE : kann mir jemand verraten wie ich das anstellen muß, das label mir nur zb 49,08 MB anzeigt statt 49,08995674 MB ?

und supi wäre es wenn zb die 649 MB überschritten werden ein fenster sichtbar wird wo einen daran erinnert das jetztr die 649 MB überschritten werden.

also danke für eure hilfe und einen schönen tag noch

patrick :wink:

_________________
Glauben heißt nichts wissen ...
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Di 05.08.03 06:41 
Hallo

schau dir z.B. Floattostrf an

ausblenden Delphi-Quelltext
1:
  label1.caption := FloatToStrF(493.0413135,fffixed,8,2);					


zur 2. Frage: wo ist da das Problem?

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Di 05.08.03 08:41 
Zur 2. Fragen:

ausblenden Delphi-Quelltext
1:
2:
if (GetDirSize(ordnercount, True) /  Sqr(1024)) > 649 then
  ShowMessage('Ihre Daten sind größer als 649 MB');

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
patrick dee Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 311

Win 98SE, WinXP
D3,D6
BeitragVerfasst: Di 05.08.03 08:55 
hi

vielen dank an derdoc für die hilfe.

allerdings komme ich mit dem :
Zitat:

label1.caption := FloatToStrF(493.0413135,fffixed,8,2);

nicht klar wie bringe ich das in eine zeile :

ist die 493.0413135 gleich dem ordercount ??

danke

patrick

_________________
Glauben heißt nichts wissen ...
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Di 05.08.03 09:25 
Zitat:

ist die 493.0413135 gleich dem ordercount ??

nein,
es ist
ausblenden Quelltext
1:
GetDirSize(ordnercount, True) /  Sqr(1024))					

die 493.blablabla war nur ein beispiel

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
recall
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 449



BeitragVerfasst: Mo 11.08.03 00:33 
Wollte ich noch anhängen:

Anstatt ShowMessage() gibts noch MessageBox() und MessageDlg().
Je nachdem wie es halt aussehen soll und wozu du es brauchst :)

Und klar geht's mit:
ausblenden Quelltext
1:
label1.caption := FloatToStrF(493.0413135,fffixed,8,2);					


Aber einfache Mathematik besagt:
ausblenden Quelltext
1:
label1.Caption := FloatToStr(Round(493.0413135*100)/100);					


Viele Grüsse.