Get the drive letter of the current optical drive.

zhaozj2021-02-11  159

Procedure getcdrom (var CD: char);

VAR

Str: string;

Drivers: integer;

Driver: char;

I, TEMP: INTEGER;

Begin

Drivers: = getLogicalDrives;

Temp: = (1 and drivers);

For i: = 0 to 26 do

Begin

IF Temp = 1 THEN

Begin

Driver: = char (i integer ('a'));

Str: = driver ':';

If GetDriveType (Pchar (STR)) = drive_cdrom then

Begin

Cd: = driver;

EXIT;

END;

END;

Drivers: = (Drivers SHR 1);

Temp: = (1 and drivers);

END;

END;

转载请注明原文地址:https://www.9cbs.com/read-5849.html

New Post(0)