Delphi Sources

Cуществует ли диск в системе



Автор: Serious

function DriveExists(Drive: Byte): boolean;
begin
  Result := Boolean(GetLogicalDrives and (1 shl Drive));
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  Drive: byte;
begin
  for Drive := 0 to 25 do
    if DriveExists(Drive) then
      ListBox1.Items.Add(Chr(Drive + $41));
end;