Sign in Join
Wiki copytemporary

CD open close: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
1-*(Windows only)*
2-
3-These procedures open and close a CD / DVD drive:
4-
5-``` pascal
6-uses MMSystem, ...;
1+[![Windows logo - 2012.svg](https://upload.wikimedia.org/wikipedia/commons/thumb/5/5f/Windows_logo_-_2012.svg/50px-Windows_logo_-_2012.svg.png)](</File:Windows_logo_-_2012.svg>)
72
8-...
3+This article applies to [Windows](</Category:Windows> "Category:Windows") only.
94
10-procedure TForm1.Button1Click(Sender: TObject);
11-begin
12-// opens the CD-ROM drive
13-mciSendstring('SET CDAUDIO DOOR OPEN', nil , 0, Form1.Handle);
14-mciSendString ('close cdlw', nil, 0, 0)
15-end;
5+See also: [[Multiplatform Programming Guide]]
166
17-procedure TForm1.Button2Click (Sender: TObject);
18-begin
19-// closes the CD-ROM drive
20-mciSendstring('SET CDAUDIO DOOR CLOSED', nil , 0, Form1.Handle);
21-mciSendString ('close cdlw', nil, 0, 0)
22-end;
7+│ **[[CD open close/de|Deutsch (de)]]** │ **English (en)** │
238
24-...
9+These procedures open and close a CD / DVD drive:
2510```
26-
27-If you want to wait until the last operation is finished then this procedure will open/close a CD-ROM/DVD depending on the value of the **blnOpen** boolean variable:
11+uses MMSystem, ...;
12+
13+ ...
14+
15+ procedure TForm1.Button1Click(Sender: TObject);
16+ begin
17+ // opens the CD-ROM drive
18+ mciSendstring('SET CDAUDIO DOOR OPEN', nil , 0, Form1.Handle);
19+ mciSendString ('close cdlw', nil, 0, 0)
20+ end;
21+
22+ procedure TForm1.Button2Click (Sender: TObject);
23+ begin
24+ // closes the CD-ROM drive
25+ mciSendstring('SET CDAUDIO DOOR CLOSED', nil , 0, Form1.Handle);
26+ mciSendString ('close cdlw', nil, 0, 0)
27+ end;
28+
29+ ...
30+```
2831
29-``` pascal
32+If you want to wait until the last operation is finished then this procedure will open/close a CD-ROM/DVD depending on the value of the **blnOpen** boolean variable:
33+```
3034uses
31- MMSystem, ...;
32-
33- ...
34-
35-procedure cdOpenClose(chrDriveChar: char; blnOpen: boolean);
36-begin
37- if mciSendString(PChar('open ' + chrDriveChar + ': type cdaudio alias cdlw'), nil, 0, 0) = 0 then
35+ MMSystem, ...;
36+
37+ ...
38+
39+ procedure cdOpenClose(chrDriveChar: char; blnOpen: boolean);
3840 begin
39- // open CD-ROM drive
40- if blnOpen = True then
41- mciSendString('set cdlw door open wait', nil, 0, 0)
42- // close CD-ROM drive
43- else
44- mciSendString('set cdlw door closed wait', nil, 0, 0);
45-
46- mciSendString('close cdlw', nil, 0, 0);
41+ if mciSendString(PChar('open ' + chrDriveChar + ': type cdaudio alias cdlw'), nil, 0, 0) = 0 then
42+ begin
43+ // open CD-ROM drive
44+ if blnOpen = True then
45+ mciSendString('set cdlw door open wait', nil, 0, 0)
46+ // close CD-ROM drive
47+ else
48+ mciSendString('set cdlw door closed wait', nil, 0, 0);
49+
50+ mciSendString('close cdlw', nil, 0, 0);
51+ end;
4752 end;
48-end;
49-
50- ...
51-
53+
54+ ...
5255```
5356
5457---
55-*From the Free Pascal wiki, page "CD open close", as it stood on 2020-02-10 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
58+*From the Free Pascal wiki, page "CD open close", as the Internet Archive kept it on 2025-02-15, last changed on 2020-02-11. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history