Autor Beitrag
foxy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Di 21.01.03 09:10 
Guden all ma ne Frage zu dem Ding da :lol:

ich rechne meine FreeSpace auf der Platte aus, wo mein Prog drauf iss mmit diesem code
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
function GetDiskSize(drive:Char; var free_size, total_size: Int64):Boolean;
var
  RootPath       :Array[0..4] of Char;
  RootPtr        :PChar;
  current_dir    :String;
Begin
 RootPath[0] := Drive;
 RootPath[1] := ':';
 RootPath[2] := '\';
 RootPath[3] := #0;
 RootPtr := RootPath;
 current_dir := GetCurrentDir;
 If SetCurrentDir(drive + ':\') then
   begin
     GetDiskFreeSpaceEx(RootPtr, Free_size, Total_size,nil);
     SetCurrentDir(current_dir);
     Result := True;
   end
   else
   Begin
     Result := False;
     Free_size := -1;
     total_size := -1;
   end;
 end;


mir iss klar, das ich bei free_size keine mb oder gigabitewerte bekomme , aber wenn ich das anzeige mit Gauge1.progress := free_size;
isses immer 100% also wie kann ich das umrechnen, das ich die richtige % Zahl rausbekomme?

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Di 21.01.03 10:39 
Hallo,

ausblenden Quelltext
1:
2:
if (Total_size>0) then Gauge1.progress:=Trunc(Free_size/Total_size*100.0)
  else Gauge1.progress:=0;

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
foxy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Di 21.01.03 11:06 
jaaaa vielen dank es geht :lol:
nur noch kurze frage was iss der befehl Trunc ??

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Di 21.01.03 11:08 
Hallo,

Zitat:

Trunc konvertiert eine Gleitkommazahl in einen Integer-Wert.

X ist ein Gleitkommaausdruck. Die Funktion gibt einen Int64-Wert mit dem gegen 0 gerundeten Wert von X zurück.

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
foxy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Di 21.01.03 11:19 
ahhh dankeschön

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)