全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1312
推到 Plurk!
推到 Facebook!

開某一台光碟機

答題得分者是:Miles
ko
資深會員


發表:28
回覆:785
積分:444
註冊:2002-08-14

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-01-10 12:12:55 IP:61.221.xxx.xxx 未訂閱
想到頭殼生虱母~"~ mciSendStringA(PChar('open e:\ type cdaudio alias cd'),nil,0 ,0); mciSendStringA(PChar('set cd door open'),'' ,0 ,0); mciSendStringA(PChar('close cd'),'' ,0 ,0); 以上段程式碼,在2000作業系統上可以正常作業但是在98上... 會出現程式出現錯誤 98上紅色那段可以跑,到藍色那2段就會出現錯誤了 有哪位大大,救命阿~"~ 註:這是指定光碟機自動開艙用的
------
======================
昏睡~
不昏睡~
不由昏睡~
Miles
尊榮會員


發表:27
回覆:662
積分:622
註冊:2002-07-12

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-01-10 13:53:31 IP:211.76.xxx.xxx 未訂閱
Hi Ko 兄: 小弟不清楚您的程式, 請試試以下這段

轉貼    procedure OpenDoor;
var
  FID : Word;
  FFlags : Longint;
  fErrCode : longint;
  OpenParms : TMCI_Open_Parms;
  SetParms: TMCI_Set_Parms;
begin
  { open CD-ROM device }
   FFlags := 0;
   FFlags := mci_notify or mci_open_type or mci_open_shareable;
   OpenParms.lpstrDeviceType := 'CDAudio';
   OpenParms.dwCallback := 0;
   fErrCode := mciSendCommand(0, mci_open, FFlags, Longint(@OpenParms));
   FID := OpenParms.wDeviceID;
 
  { open CD-ROM door }
  FFlags := 0;
  FFlags := mci_notify or mci_set_door_open;
  SetParms.dwCallback := 0;
  fErrCode := mciSendCommand(FID, mci_Set, FFlags, Longint(@SetParms));
 
  { close CD-ROM device }
  FFlags := 0;
  FFlags := mci_notify or mci_set_door_closed;
  SetParms.dwCallback := 0;
  fErrCode := mciSendCommand(FID, mci_Set, FFlags, Longint(@SetParms) );    end;
我不是高手, 高手是正在銀幕前微笑的人.
------


我不是高手, 高手是正在銀幕前微笑的人.
Miles
尊榮會員


發表:27
回覆:662
積分:622
註冊:2002-07-12

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-01-10 15:35:14 IP:211.76.xxx.xxx 未訂閱
另一個方法, 可以指定多台

Procedure CloseDoor(Driveletter:Char);
Var
Alias : String;
Begin
   Alias:='Drive' DriveLetter;
   mciSendString(pChar('Open ' DriveLetter ': Alias '  Alias ' Type CDAudio'), nil, 0, 0);
   mciSendString(pChar('Set ' Alias ' Door Closed'), nil, 0, 0);
   mciSendString(pChar('Close ' DriveLetter ': Alias '  Alias ' Type CDAudio'), nil, 0, 0);
End;    Procedure OpenDoor(Driveletter:Char);
Var
Alias : String;
Begin
   Alias:='Drive' DriveLetter;
   mciSendString(pChar('Open ' DriveLetter ': Alias '  Alias ' Type CDAudio'), nil, 0, 0);
   mciSendString(pChar('Set ' Alias ' Door Open'), nil, 0, 0);
   mciSendString(pChar('Close ' DriveLetter ': Alias '  Alias ' Type CDAudio'), nil, 0, 0);
End;    例如
   OpenDoor(Edit1.Text[1]);
我不是高手, 高手是正在銀幕前微笑的人.
------


我不是高手, 高手是正在銀幕前微笑的人.
系統時間:2024-05-04 0:36:48
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!