delphi获取盘符代码


本文整理自网络,侵删。

 

delphi获取盘符代码

unction GetDriverList():TStrings;
var
Index:Integer;
S:string;
List:TStringList;
begin
SetLength(S,255);
FillChar(S[1],255,#0);
List := TStringList.Create();
GetLogicalDriveStrings(255,Pointer(S));//GetLogicalDriveStrings 是获取所有逻辑磁盘字母,D,E...”
for Index := 1 to 255 do
if S[Index] = #0 Then S[Index] := ',';
List.CommaText := S;
Result := TStringList.Create();
for Index := 0 to List.Count - 1 do
if List.Strings[Index] <> '' then Result.Add(List.Strings[Index]);
List.Free();
end;

procedure TForm1.Button1Click(Sender: TObject);
var
List:TStrings;
begin
List := GetDriverList();
ShowMessage(List.Text);
List.Text;
end;

相关阅读 >>

Delphi使用hough变换查找直线

Delphi:out参数和var参数的区别

Delphi xe5下安卓开发技巧

Delphi record,两种声明方式

Delphi xe 遍历指定数据库,清空各表记录

Delphi6-xe5 中的md5实现方法

Delphi hbp-1100u 欧姆龙血压计的usb调用方法

Delphi 调用外部 dll 中的函数(1. 早绑定)

Delphi 枚举消息钩子的代码

Delphi 开发安卓时判断进入非活动

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



打赏

取消

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

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

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

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

评论

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