Board index » delphi » How do I access the CD-ROM drive

How do I access the CD-ROM drive

Hello and thank you for reading my question.

I am using Delphi4 Pro.

I am writing a program that will access text files on the CD drive.

What I would like to know is how to access the drive letter that the CD has,
given that depending upon how many drives the user may have on their system
there is no way of knowing what their drive letter is in advance.

In other words how do you detect the current drive letter the CD is in, and
write in the software to look for the text file in that drive.

Thank you

Ivan.

 

Re:How do I access the CD-ROM drive


go to Torry's at www.torry.ru and look in the
VCL Files and Drives section. There are several components
for doing this, some with source so you can see how it's done.

On Mon, 30 Aug 1999 10:19:09 +1000, "Ivan Carey" <ica...@iname.com>
wrote:

Quote
>Hello and thank you for reading my question.

>I am using Delphi4 Pro.

>I am writing a program that will access text files on the CD drive.

>What I would like to know is how to access the drive letter that the CD has,
>given that depending upon how many drives the user may have on their system
>there is no way of knowing what their drive letter is in advance.

>In other words how do you detect the current drive letter the CD is in, and
>write in the software to look for the text file in that drive.

>Thank you

>Ivan.

Re:How do I access the CD-ROM drive


You can use a couple of Win 32 API calls. GetLogicalDriveStrings will return
a list of available drives (see also GetLogicalDrives). After getting the
list you can call GetDriveType for each of the returned strings.
GetDriveType will tell you type kind of device associated with a drive
letter. (Don't forget that it is not uncommon for systems to have more than
1 CD attached.)

Quote
Ivan Carey <ica...@iname.com> wrote in message

news:i6ky3.2147$1E2.13984@ozemail.com.au...
Quote
> Hello and thank you for reading my question.

> I am using Delphi4 Pro.

> I am writing a program that will access text files on the CD drive.

> What I would like to know is how to access the drive letter that the CD
has,
> given that depending upon how many drives the user may have on their
system
> there is no way of knowing what their drive letter is in advance.

> In other words how do you detect the current drive letter the CD is in,
and
> write in the software to look for the text file in that drive.

> Thank you

> Ivan.

Re:How do I access the CD-ROM drive


  There's a problem (that I eventually stumbled on) with doing that:  What
happens when they have (as I do) two CD-ROMs?  Or in my case:  3  (DVD, CD-R
and a Virtual CD...)  --  It's easier to just ask the user which drive has
your CD, and then save that info in the Registry...  --  OR, start with C
(first hard drive) and check for the file wherever it's at, and when you
find it:  There's your CD....

--
Jason Wallace
SL Software          Bomb Tech:  If you see me running, try and keep up!"
Dark...@SLSoftware.reno.nv.us
Jason_Wall...@Intuit.com
--

Quote
Ivan Carey <ica...@iname.com> wrote in message

news:i6ky3.2147$1E2.13984@ozemail.com.au...
Quote
> Hello and thank you for reading my question.

> I am using Delphi4 Pro.

> I am writing a program that will access text files on the CD drive.

> What I would like to know is how to access the drive letter that the CD
has,
> given that depending upon how many drives the user may have on their
system
> there is no way of knowing what their drive letter is in advance.

> In other words how do you detect the current drive letter the CD is in,
and
> write in the software to look for the text file in that drive.

> Thank you

> Ivan.

Re:How do I access the CD-ROM drive


On Tue, 31 Aug 1999 08:29:32 -0700, "Jason Wallace"

Quote
<Dark...@SLSoftware.reno.nv.us> wrote:
>  There's a problem (that I eventually stumbled on) with doing that:  What
>happens when they have (as I do) two CD-ROMs?  Or in my case:  3  (DVD, CD-R
>and a Virtual CD...)  --  It's easier to just ask the user which drive has
>your CD, and then save that info in the Registry...  --  OR, start with C
>(first hard drive) and check for the file wherever it's at, and when you
>find it:  There's your CD....

Or you take all letters that are assigned to CD-ROM drives and check
them all for the desired files. Then you don't have to store any
informations in the registry and the program doesn't have to ask agin
for a drive letter when the drive letter changes...
Jan Peter Stotz
     _  ____   ____
    | ||  _ \ / ___|
 _  | || |_) |\___ \
| |_| ||  __/  ___) |
 \___/ |_|    |____/

Other Threads