您现在的位置:首页 >> 硬件系统 >> 硬件系统 >> 内容

Delphi中实现磁盘信息类(TDriveInfo)

时间:2011/9/3 15:18:11 点击:

  核心提示:代码调用范例:procedure TForm1.FormCreate(Sender: TObject);var drive: TDriveInfo;begin for drive in TDriveI...

代码调用范例:

procedure TForm1.FormCreate(Sender: TObject);
var
  drive: TDriveInfo;
begin
  for drive in TDriveInfo.GetDrives do
  with Memo1.Lines do
  begin
    if drive.IsReady then
    begin
      Add(Format('Name: %s', [drive.Name]));
      Add(Format('AvailableFreeSpace: %d', [drive.AvailableFreeSpace]));
      Add(Format('TotalFreeSpace: %d', [drive.TotalFreeSpace]));
      Add(Format('TotalSize: %d', [drive.TotalSize]));
      Add(Format('DriveFormat: %s', [drive.DriveFormat]));
      Add(Format('DriveType: %s', [drive.DriveTypeString]));
      Add(Format('VolumeLabel: %s', [drive.VolumeLabel]));
    end
    else
    begin
      Add(Format('Drive %s is not ready', [drive.Name]));
    end;
  end;
end;



迅雷专用高速下载

作者:左保权(Bob) 来源:转载
共有评论 0相关评论
发表我的评论
  • 大名:
  • 内容:
  • 盒子文章(www.2ccc.com) © 2022 版权所有 All Rights Reserved.
  • 沪ICP备05001939号