Autor Beitrag
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: So 16.02.03 16:58 
Wie kann ich ein CD-Laufwerk mittels seines Buchstaben öffnen lassen?

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
bis11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: So 16.02.03 17:59 
Hi,

ich hätte da mal einen Tipp von den Schweizer Kollegen :
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
uses 
  MMSystem; 

// Open , Öffnen 
{Simple Way:} 
  mciSendstring('SET CDAUDIO DOOR OPEN WAIT', nil, 0, Self.Handle); 

{More complex way:} 
function OpenCD(Drive: Char): Boolean; 
var 
  Res: MciError; 
  OpenParm: TMCI_Open_Parms; 
  Flags: DWORD; 
  S: string; 
  DeviceID: Word; 
begin 
  Result := False; 
  S := Drive + ':'
  Flags  := MCI_OPEN_TYPE or MCI_OPEN_ELEMENT; 
  with OpenParm do 
  begin 
    dwCallback := 0; 
    lpstrDeviceType := 'CDAudio'
    lpstrElementName := PChar(S); 
  end; 
  Res := mciSendCommand(0, MCI_OPEN, Flags, Longint(@OpenParm)); 
  if Res <> 0 then Exit; 
  DeviceID := OpenParm.wDeviceID; 
  try 
    Res := mciSendCommand(DeviceID, MCI_SET, MCI_SET_DOOR_OPEN, 0); 
    if Res = 0 then Exit; 
    Result := True; 
  finally 
    mciSendCommand(DeviceID, MCI_CLOSE, Flags, Longint(@OpenParm)); 
  end; 
end

//Close, Schliessen 
{Simple Way:} 
  mciSendstring('SET CDAUDIO DOOR CLOSED WAIT', nil, 0, Self.Handle); 

{More complex way:} 
function CloseCD(Drive: Char): Boolean; 
var 
  Res: MciError; 
  OpenParm: TMCI_Open_Parms; 
  Flags: DWORD; 
  S: string; 
  DeviceID: Word; 
begin 
  Result := False; 
  S := Drive + ':'
  Flags  := MCI_OPEN_TYPE or MCI_OPEN_ELEMENT; 
  with OpenParm do 
  begin 
    dwCallback := 0; 
    lpstrDeviceType := 'CDAudio'
    lpstrElementName := PChar(S); 
  end; 
  Res := mciSendCommand(0, MCI_OPEN, Flags, Longint(@OpenParm)); 
  if Res <> then Exit; 
  DeviceID := OpenParm.wDeviceID; 
  try 
    Res := mciSendCommand(DeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, 0); 
    if Res = 0 then Exit; 
    Result := True; 
  finally 
    mciSendCommand(DeviceID, MCI_CLOSE, Flags, Longint(@OpenParm)); 
  end; 
end;

Vielleicht hast Du sowas gesucht.

Moderiert von user profile iconTino: Sourcecode eingefügt.
derDoc Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: So 16.02.03 18:20 
Danke, das ist genau das, was ich gesucht hatte.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.