nabildatone
asked on
Eject/Close CD-rom drive in one command
How can I eject and close cd-rom drive by one button , so if it is closed I eject, if it is opened I close it .
I know that for close :
mcisendmessage('set cdaudio door closed wait',nil,0,handle);
and for Eject is : mcisendmessage('set cdaudio door closed wait',nil,0,handle);
I would know how combine the two commands in one procedure for ejecting or closing cd-rom drive .
I know that for close :
mcisendmessage('set cdaudio door closed wait',nil,0,handle);
and for Eject is : mcisendmessage('set cdaudio door closed wait',nil,0,handle);
I would know how combine the two commands in one procedure for ejecting or closing cd-rom drive .
listening...
listening...
Hi,
I think zifnab is the expert here who knows a lot about it, but i haven't seen him here for a while. The code below comes from him.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
const
DBT_DEVICEARRIVAL = 32772;
DBT_DEVICEREMOVECOMPLETE = 32768;
type
TForm1 = class(TForm)
procedure WndProc(var Msg: TMessage); override;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.WndProc(var Msg: TMessage);
begin
if Msg.Msg = WM_DEVICECHANGE then begin
case Msg.wParam of
DBT_DEVICEARRIVAL : begin
showmessage('CD DOOR OPEN');
end;
DBT_DEVICEREMOVECOMPLETE : begin
showmessage('CD DOOR CLOSE');
end;
end;
end
else inherited WndProc(MSg);
end;
end.
I think zifnab is the expert here who knows a lot about it, but i haven't seen him here for a while. The code below comes from him.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
const
DBT_DEVICEARRIVAL = 32772;
DBT_DEVICEREMOVECOMPLETE = 32768;
type
TForm1 = class(TForm)
procedure WndProc(var Msg: TMessage); override;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.WndProc(var Msg: TMessage);
begin
if Msg.Msg = WM_DEVICECHANGE then begin
case Msg.wParam of
DBT_DEVICEARRIVAL : begin
showmessage('CD DOOR OPEN');
end;
DBT_DEVICEREMOVECOMPLETE : begin
showmessage('CD DOOR CLOSE');
end;
end;
end
else inherited WndProc(MSg);
end;
end.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Listening...
listening...for moment
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
accept DrDelphi's comment as answer
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Thanks,
geobul
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
accept DrDelphi's comment as answer
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Thanks,
geobul
EE Cleanup Volunteer
my question is:
https://www.experts-exchange.com/questions/20765551/DeviceIOControl-win9x-close-cdrom-door.html
please help.
https://www.experts-exchange.com/questions/20765551/DeviceIOControl-win9x-close-cdrom-door.html
please help.