~~~~~~~~~~~~~~~~~~~~~~~~~
function IsAudioCD(Drive : char) : bool;
var
DrivePath : string;
MaximumComponentLength : DWORD;
FileSystemFlags : DWORD;
VolumeName : string;
begin
Result := false;
DrivePath := Drive + ':\';
if GetDriveType(PChar(DrivePath))
<> DRIVE_CDROM then exit;
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;
{Usage:}
procedure TForm1.Button1Click(Sender: TObject) ;
begin
if not IsAudioCD('D') then
ShowMessage('Not an Audio CD in drive D') ;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~
Delphi tips navigator:
» Show / Hide Desktop Icons
« Hide a process in the 'Close Program' Window

