关于控制多个光驱的问题(100分)

  • 主题发起人 主题发起人 plf22
  • 开始时间 开始时间
P

plf22

Unregistered / Unconfirmed
GUEST, unregistred user!
如何控制多个光驱的弹出和关闭,以前看到过很多相关的内容,但都是几个光驱<br>一起弹出或一起关闭,请问如何控制单独选定那一个,其他光驱不受影响
 
高手在哪里啊,这个问题困惑我很久了,请各位帮帮忙吧![:)]
 
代码如下:<br>uses MMSYSTEM;<br>procedure CloseCD(Drive: Char);<br>Var<br>&nbsp; Res : MciError;<br>&nbsp; OpenParm: TMCI_Open_Parms;<br>&nbsp; Flags : DWord;<br>&nbsp; S : String;<br>&nbsp; DeviceID : Word;<br>begin<br>&nbsp; S:=Drive+':';<br>&nbsp; Flags:=mci_Open_Type or mci_Open_Element;<br>&nbsp; With OpenParm do begin<br>&nbsp; &nbsp; dwCallback := 0;<br>&nbsp; &nbsp; lpstrDeviceType := 'CDAudio';<br>&nbsp; &nbsp; lpstrElementName := PChar(S);<br>&nbsp; end;<br>&nbsp; Res := mciSendCommand(0, mci_Open, Flags, Longint(@OpenParm));<br>&nbsp; IF Res&lt;&gt;0 Then exit;<br>&nbsp; DeviceID:=OpenParm.wDeviceID;<br>&nbsp; try<br>&nbsp; &nbsp; Res:=mciSendCommand(DeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, 0);<br>&nbsp; &nbsp; IF Res=0 Then exit;<br>&nbsp; finally<br>&nbsp; &nbsp; mciSendCommand(DeviceID, mci_Close, Flags, Longint(@OpenParm));<br>&nbsp; end;<br>end;<br><br>procedure OpenCD(Drive: Char);<br>Var<br>&nbsp;Res : MciError;<br>&nbsp;OpenParm: TMCI_Open_Parms;<br>&nbsp;Flags : DWord;<br>&nbsp;S : String;<br>&nbsp;DeviceID : Word;<br>begin<br>&nbsp; S:=Drive+':';<br>&nbsp; Flags:=mci_Open_Type or mci_Open_Element;<br>&nbsp; With OpenParm do begin<br>&nbsp; &nbsp; dwCallback := 0;<br>&nbsp; &nbsp; lpstrDeviceType := 'CDAudio';<br>&nbsp; &nbsp; lpstrElementName := PChar(S);<br>&nbsp; end;<br>&nbsp; Res := mciSendCommand(0, mci_Open, Flags, Longint(@OpenParm));<br>&nbsp; IF Res&lt;&gt;0 Then exit;<br>&nbsp; DeviceID:=OpenParm.wDeviceID;<br>&nbsp; try<br>&nbsp; &nbsp; Res:=mciSendCommand(DeviceID, MCI_SET, MCI_SET_DOOR_OPEN, 0);<br>&nbsp; &nbsp; IF Res=0 Then exit;<br>&nbsp; finally<br>&nbsp; &nbsp; mciSendCommand(DeviceID, mci_Close, Flags, Longint(@OpenParm));<br>&nbsp; end;<br>end;<br>
 
这个问题比较复杂,我写信告诉你。
 
多人接受答案了。
 
后退
顶部