Re: Eject cd-player!


[ Related Articles and Replies ] [ DelphiLand FAQ ] [ Delphi Tutorials ]

Posted by Bopzzz on January 09, 2002 at 19:34:46:

In Reply to: Re: Eject cd-player! posted by JiiPee on December 28, 2001 at 15:03:13:

Hey!

This one is very usefull!

-Add 'mmsystem' to uses.
-After {$R *.DFM} you place this procedure:

procedure OpenCd(AOpen:Boolean);

const
MAXERRORLENGTH = 128;

DoPlay : array[Boolean] of String =
('Set cdaudio door closed wait',
'Set cdaudio door open wait');
var
MyError : LongInt;
MyErrorString : array[0..MAXERRORLENGTH - 1] of char;
begin
MyError := mciSendString(pChar(DoPlay[AOpen]), nil, 0, 0);
if MyError <> 0 then
begin
MciGetErrorString(MyError,MyErrorString,MAXERRORLENGTH - 1);
Showmessage(MyErrorString);
Exit;
end;

-And do this: OpenCd(TRUE);
Or this: OpenCD(FALSE); (doh)

Bye!

Bop
(only 15 years!)


Related Articles and Replies


[ Related Articles and Replies ] [ DelphiLand FAQ ] [ Delphi Tutorials ]