...check if CD-ROM is open?
Author: Simon Grossenbacher
uses
mmsystem;
procedure TForm1.Button1Click(Sender: TObject);
var
s: array[0..64] of Char;
error: Cardinal;
Text: array[0..255] of Char;
begin
error := mciSendstring('open cdaudio alias geraet', nil, 0, Handle);
if error <> 0 then
begin
mciGetErrorstring(error, @Text, 255);
ShowMessage(Text);
mciSendstring('close geraet', nil, 0, Handle);
Exit;
end;
error := mciSendstring('status geraet mode', @s, SizeOf(s), Handle);
if error <> 0 then
begin
mciGetErrorstring(error, @Text, 255);
ShowMessage(Text);
mciSendstring('close geraet', nil, 0, Handle);
Exit;
end;
mciSendstring('close geraet', nil, 0, Handle);
ShowMessage('Message: ' + s);
end;
printed from
www.swissdelphicenter.ch
developers knowledge base