Sign in Join
Wiki copytemporary

Disk in Drive: what changed

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

OldNewLine
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>)
1+The function checks whether there is a disk medium in the CD or DVD drive.
22
3-This article applies to [Windows](</Category:Windows> "Category:Windows") only.
3+``` pascal
4+ uses
5+ SysUtils, ...;
46
5-See also: [[Multiplatform Programming Guide]]
7+ // enumeration for the return values
8+ grade
9+ byte = (enmNoDriveLetter, enmMoMedInserted, enmMedInserted, enmError);
610
7-│ **[[Disk in Drive/de|Deutsch (de)]]** │ **English (en)** │
8-****
11+ ...
912
10-The function checks whether there is a disk medium in the CD or DVD drive.
11-```
12-uses
13- SysUtils, ...;
14-
15- // enumeration for the return values
16- grade
17- byte = (enmNoDriveLetter, enmMoMedInserted, enmMedInserted, enmError);
18-
19- ...
20-
21- function funDiskInDrive (chrDrive : char) : byte;
22- begin
23-
24- Result := enmNoDriveLetter;
25- chrDrive := UpCase(chrDrive);
26-
27- // Checks whether the drive letter is valid.
28- if not (chrDrive in ['A' .. 'Z']) then
29- exit;
30-
31- // Checks if the drive contains media.
32- try
33- if DiskSize ( Ord ( chr drive ) - $ 40 ) <> - 1 then
34- Result := enmMedInserted
35- else
36- Result := enmNoMedInserted;
37- except
38- Result := enmError;
39- end;
40-
41- end;
42-
43- ...
44-```
13+ function funDiskInDrive (chrDrive : char) : byte;
14+ begin
4515
46-Example of calling the function:
16+ Result := enmNoDriveLetter;
17+ chrDrive := UpCase(chrDrive);
18+
19+ // Checks whether the drive letter is valid.
20+ if not (chrDrive in ['A' .. 'Z']) then
21+ exit;
22+
23+ // Checks if the drive contains media.
24+ try
25+ if DiskSize ( Ord ( chr drive ) - $ 40 ) <> - 1 then
26+ Result := enmMedInserted
27+ else
28+ Result := enmNoMedInserted;
29+ except
30+ Result := enmError;
31+ end;
32+
33+ end;
34+
35+ ...
4736```
48-...
49-
50- case funDiskInDrive('F') of
51- enmNoDriveLetter : ... ;
52- enmNoMedInserted : ... ;
53- enmMedInserted : ... ;
54- Error : ... ;
55- end;
56-
57- ...
37+
38+Example of calling the function:
39+
40+``` pascal
41+ ...
42+
43+ case funDiskInDrive('F') of
44+ enmNoDriveLetter : ... ;
45+ enmNoMedInserted : ... ;
46+ enmMedInserted : ... ;
47+ Error : ... ;
48+ end;
49+
50+ ...
5851```
5952
6053---
61-*From the Free Pascal wiki, page "Disk in Drive", as the Internet Archive kept it on 2025-04-21. 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).*
54+*From the Free Pascal wiki, page "Disk in Drive", as it stood on 2020-02-13 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).*

Back to history