本文整理自网络,侵删。
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 winapi: getforegroundwindow - 获取前台窗口的句柄
Delphi将n个相同字符提取到左边,m个相同字符提取到右边
更多相关阅读请进入《Delphi》频道 >>