Советы по Delphi


Как распознать тип носителя?


Своим опытом делится Олег Кулабухов:

Используем функцию GetDriveType.

    procedure TForm1.Button1Click(Sender: TObject);
begin
case
GetDriveType('C:\') of
0 : ShowMessage('The drive type cannot be determined');
1 : ShowMessage('The root directory does not exist');
DRIVE_REMOVABLE:ShowMessage('The disk can be removed');
DRIVE_FIXED : ShowMessage('The disk cannot be removed');
DRIVE_REMOTE : ShowMessage('The drive is remote (network) drive');
DRIVE_CDROM : ShowMessage('The drive is a CD-ROM drive');
DRIVE_RAMDISK : ShowMessage('The drive is a RAM disk');
end;
end;

[001862]



Содержание раздела