Воскресенье, 19.05.2024, 16:49
Приветствую Вас Гость | RSS
delphicode.clan.su
Форма входа
Поиск
Статистика

Онлайн всего: 1
Гостей: 1
Пользователей: 0
 
 ОПРЕДЕЛИТЬ РАЗМЕР СВОБОДНОГО МЕСТА НА ДИСКЕ
  
 

Добавим на форму компоненты TListBox и TButton. В обработчике 

события OnClick запишем следующее:

  
 
procedure TForm1.Button1Click(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;