随笔 - 2146  文章 - 97 评论 - 11767 trackbacks - 253

//磁盘类型 GetDriveType
var
  Drive: Char;
  DriveLetter: String[4];
begin
  for Drive := 'A' to 'Z' do
  begin
    DriveLetter := Drive + ':\';
    case GetDriveType(PChar(Drive + ':\')) of
      DRIVE_REMOVABLE:
      Memo1.Lines.Add(DriveLetter + ' Floppy Drive');
      DRIVE_FIXED:
      Memo1.Lines.Add(DriveLetter + ' Fixed Drive');
      DRIVE_REMOTE:
      Memo1.Lines.Add(DriveLetter + ' Network Drive');
      DRIVE_CDROM:
      Memo1.Lines.Add(DriveLetter + ' CD-ROM Drive');
      DRIVE_RAMDISK:
      Memo1.Lines.Add(DriveLetter + ' RAM Disk');
    end;
  end;
end;

posted on 2007-12-12 01:06  万一  阅读(...)  评论(...编辑  收藏