unit FileSys1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
Type
TDiskInfo = Record
SectorsPerCluster : DWORD;
BytesPerSector : DWORD;
FreeClusters : DWORD;
NumClusters : DWORD;
BytesTotal : DWORD;
BytesFree : DWORD;
End;
var
DiskInfo : TDiskInfo;
begin
With DiskInfo do
Begin
GetDiskFreeSpace('c:\', SectorsPerCluster,BytesPerSector,
FreeClusters, NumClusters);
BytesTotal := NumClusters*SectorsPerCluster*BytesPerSector;
BytesFree := FreeClusters*SectorsPerCluster*BytesPerSector;
Label1.Caption := Format('Sectors/Cluster : %d', [SectorsPerCluster]);
Label2.Caption := Format('Bytes/Sector : %d', [BytesPerSector]);
Label3.Caption := Format('Free Clusters : %d', [FreeClusters]);
Label4.Caption := Format('Total Clusters : %d', [NumClusters]);
Label5.Caption := Format('Total bytes : %d', [BytesTotal]);
Label6.Caption := Format('Free bytes : %d', [BytesFree]);
End;
end;
end.
|