unit SpeicherCheck;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 =
class(TForm)
RadioButton1: TRadioButton;
Button1: TButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
procedure Button1Click(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
function DiskInfo(Drive:Char;
var total, avail: Int64): Boolean;
begin
Result:=GetDiskFreeSpaceEx(PChar(Drive+'
:\'), avail, total,
nil);
end;
procedure TForm2.Button1Click(Sender: TObject);
var
TotalSpace, AvailSpace: Int64;
begin
DiskInfo('
C', TotalSpace, AvailSpace);
ShowMessage(Format(
'
Gesamt: %.0n Bytes, Frei: %.0n Bytes',
[1.0 * TotalSpace,
1.0 * AvailSpace]));
end;
procedure TForm2.RadioButton1Click(Sender: TObject);
var c:Char;
total, avail:Int64;
begin
For c:='
c'
to '
z'
do begin
// Hier noch prüfen, ob Laufwerk eine Festplatte ist
DiskInfo(c, total, avail);
ListBox1.Items.Add('
Freier Speicher auf Laufwerk '+c+'
: '+IntToStr(avail
div 1024
div 1024)+'
MB))';
//
end;
end;
end.