this slowpoke moves

Check Drive for AudioCD

function IsAudioCD(Drive: string): boolean;
var FSFlags: DWord;
    MaxLength: DWord;
    VolName: String;
begin
  result := false;
  if GetDriveType(PChar(drive))=DRIVE_CDROM then begin
    SetLength(VolName, 64);
    GetVolumeInformation(PChar(Drive),
                         PChar(VolName),
                         Length(VolName),
                         nil,
                         MaxLength,
                         FSFlags, nil, 0);

    if lStrCmp(PChar(VolName), 'Audio CD')=0 then
    result := true;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  if IsAudioCD(Label1.Caption + ':') = true then
  Label1.Caption := 'Audio CD in Drive'
  else
  Label1.Caption := 'Audio CD not found';
end;

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate