Does my CD-ROM drive contain an audio CD? | |||
| |||
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; Tags: Delphi File Delete with UNDO File I/O Status Check GetDriveType GetVolumeInformation | |||
| |||
| |||
Login for comment |