Thread View: comp.lang.pascal.delphi.misc
4 messages
4 total messages
Started by Jan Hecker & Rikke Skaanes
Sun, 25 Apr 1999 00:00
Finding/detecting CD-rom drive
Author: Jan Hecker & Rikke Skaanes
Date: Sun, 25 Apr 1999 00:00
Date: Sun, 25 Apr 1999 00:00
6 lines
1059 bytes
1059 bytes
Hi, I'm making a little program, and needs the program to find/detect the drive letter of the cd-rom drive! How's that dine??? I'm usinfg Delphi 3. Jan
Re: Finding/detecting CD-rom drive
Author: Rudy Versele
Date: Sun, 25 Apr 1999 00:00
Date: Sun, 25 Apr 1999 00:00
14 lines
1283 bytes
1283 bytes
Hi Jan & Rikke! Use GetLogicalDrives. Rudy ============================ Jan Hecker & Rikke Skaanes schreef: > > Hi, > I'm making a little program, and needs the program to find/detect the > drive letter of the cd-rom drive! How's that dine??? I'm usinfg Delphi > 3. > > Jan
Re: Finding/detecting CD-rom drive
Author: Jason Wallace
Date: Mon, 26 Apr 1999 00:00
Date: Mon, 26 Apr 1999 00:00
59 lines
2255 bytes
2255 bytes
Easy enough: This will find the first CD-ROM in the format 'x:\' (where
x is the *FIRST* CD-ROM)... -- use it: MyVar := FindCDROM;
function FindCDROM: shortstring;
var
AList : TStringList;
Counter : integer;
begin
Result := 'no CDROM present';
AList := TStringList.Create;
ListDrives(AList);
for Counter := 0 to AList.Count-1 do
if GetDriveType(PChar(Alist.Strings[Counter])) = DRIVE_CDROM then
Result := Alist.Strings[Counter]
end;
procedure ListDrives(Strings: TStringList);
const BufSize = 256;
var
Buffer, P: PChar;
begin
GetMem(Buffer, BufSize);
try
Strings.BeginUpdate;
try
Strings.Clear;
if GetLogicalDriveStrings(BufSize, Buffer) <> 0 then begin
P := Buffer;
while P^ <> #0 do begin
Strings.Add(P);
Inc(P, StrLen(P) + 1);
end;
end;
finally
Strings.EndUpdate;
end;
finally
FreeMem(Buffer, BufSize);
end;
end;
--
Jason Wallace
SL Software
DarkElf@SLSoftware.reno.nv.us
--
"We are Microsoft. Resistance is Futile. You will be assimilated.
--
Jan Hecker & Rikke Skaanes <rikkejan@get2net.dk> wrote in message
news:3722E2CD.5347E78@get2net.dk...
> Hi,
> I'm making a little program, and needs the program to find/detect the
> drive letter of the cd-rom drive! How's that dine??? I'm usinfg Delphi
> 3.
>
> Jan
>
Re: Finding/detecting CD-rom drive
Author: Dave Parsons
Date: Tue, 27 Apr 1999 00:00
Date: Tue, 27 Apr 1999 00:00
30 lines
1484 bytes
1484 bytes
Jan,
I have an example on my webpage that does exactly that.
--
Good Luck!!
-Dave
Inprise Certified Delphi 4 Client/Server developer
http://www.erols.com/dparsons
Bruno BORNIL <bruno.bornil@overlap.fr> wrote in message
news:37273EA8.BB402B13@overlap.fr...
Jan Hecker & Rikke Skaanes a οΏ½crit :
> Hi,
> I'm making a little program, and needs the program to find/detect the
> drive letter of the cd-rom drive! How's that dine??? I'm usinfg Delphi
> 3.
>
> Jan
Hello,
You should use the GetDriveType function from API func.
In the case of a CD_ROM it returns an integer (5 i think).
Bye.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads