[code lang=”delphi”]procedure TForm1.Button3Click(Sender: TObject);
Var
RootPath : String;
Sec_Cluster, Bytes_Sec, Free_Clusters, Total_Clusters : DWord;
begin
// Set the Drive to check
RootPath := ‘C:\’;
GetDiskFreeSpace(PChar(RootPath), Sec_Cluster, Bytes_Sec, Free_Clusters, Total_Clusters);
// Lets put information into a ListBox
ListBox1.Items.Add(‘RootPath : ‘ + RootPath);
ListBox1.Items.Add(‘Sectors Per Cluster : ‘ + IntToStr(Sec_Cluster));
ListBox1.Items.Add(‘Bytes Per Sector : ‘ + IntToStr(Bytes_Sec));
ListBox1.Items.Add(‘Free Clusters : ‘ + IntToStr(Free_Clusters));
ListBox1.Items.Add(‘Total Clusters : ‘ + IntToStr(Total_Clusters));
ListBox1.Items.Add(‘Free Bytes : ‘ + IntToStr(Bytes_Sec * Sec_Cluster * Free_Clusters));
ListBox1.Items.Add(‘Total Bytes : ‘ + IntToStr(Bytes_Sec * Sec_Cluster * Total_Clusters));
end;
[/code]
[tags]Delphi, System[/tags]
0 Kommentare zu “GetDiskFreeSpace”