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 链接文件名合并

Delphi批量删除同类文件(带通配符)

Delphi根据进程id获取进程路径

Delphi 使用 idhttp 获取 utf-8 编码的中文网页

Delphi removedir 删除文件夹

Delphi通过post传递参数给php

Delphi 日期时间函数

Delphi debug与release的区别

Delphi 字符串中提取字母数字

Delphi实例之一个较复杂的记事本的实现

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



打赏

取消

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

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

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

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

评论

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