...get the free disk space?
Author: Simon Grossenbacher
procedure TForm1.Button1Click(Sender: TObject);
var
freeSpace, totalSpace: Double;
s: Char;
begin
// Drive letter
// Laufwerksbuchstabe
s := 'D';
freeSpace := DiskFree(Ord(s) - 64);
totalSpace := DiskSize(Ord(s) - 64);
label1.Caption := Format('Free Space: %12.0n', [freeSpace]);
Label2.Caption := Format('Total Space: %12.0n', [totalSpace]);
Label3.Caption := IntToStr(Round((totalSpace - freeSpace) / totalSpace * 100)) +
' Percent used.';
end;
printed from
www.swissdelphicenter.ch
developers knowledge base