|
|
24 April 2000 Ref. 21
You can use the following function to determine whether the current CD inside the CD-ROM drive is an Audio CD.
function IsAudioCD(CDDrive : Char) : boolean;
var
VolumeName, DrivePath : string;
MaximumComponentLength, FileSystemFlags : DWORD;
begin
DrivePath := CDDrive + ':\';
Result := FALSE;
if (GetDriveType(PChar(DrivePath)) = DRIVE_CDROM) then
begin
SetLength(VolumeName, 64);
GetVolumeInformation(PChar(DrivePath),
PChar(VolumeName), Length(VolumeName), nil, MaximumComponentLength,
FileSystemFlags, nil, 0);
if (lStrCmp(PChar(VolumeName),'Audio
CD') = 0) then Result := TRUE;
end;
end;
The function returns a value of TRUE if it's a Audio CD or FALSE, otherwise.
For Example:
-----------------
if IsAudioCD('D') then
ShowMessage('There is a Audio CD in the CD-ROM drive');
This example assume that the "D" drive is a CD-ROM drive, and will display
a message if it's an Audio CD.