delphi获取本地全部盘符并存如combobox1


本文整理自网络,侵删。

 var
  DriveNum: Integer;
  DriveChar: Char;
  DriveType: TDriveType;
  DriveBits: set of 0..25;
begin
  monitorthread := nil;
  combobox1.clear;
  Integer(DriveBits) := GetLogicalDrives;
  for DriveNum := 0 to 25 do
  begin
    if not (DriveNum in DriveBits) then Continue;
    DriveChar := Char(DriveNum + Ord('A'));//从a---z
    DriveType := TDriveType(GetDriveType(PChar(DriveChar + ':')));
    case DriveType of
      dtFixed:    combobox1.Items.Add(DriveChar+':');
    end;
  end;
  combobox1.itemindex:=0;
  ComboBox1Change(Sender);
end;

相关阅读 >>

Delphi 字符串替换函数[单元文件 sysutils]

Delphi 快速读取txt 指定行的数据

Delphi xe7开发的直接以管理员模式启动cmd命令行界面

Delphi unigui程序部署到服务器

Delphi 判断字符是否是数字

Delphi pchar与string互转

Delphi 使用钩子函数 - 数据传递

Delphi 限制tedit控件只能输入数字,小数点和负号

Delphi 在桌面中嵌入窗体

Delphi 下 vclzip控件的简单使用

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...