Click here to Skip to main content
12,943,528 members (55,416 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Please, I need a code with which I can determine the drive name of the CD drive.

I am in the process of developing a custom installer using MSIInstal function, but the function requires the path to the package to be installed. The problem I am facing
is how do I tell whether the CD drive is drive D,E,F, or G.

How do I determine this.
Posted 23-Sep-12 12:53pm
Wes Aday 23-Sep-12 19:00pm
Query the drive types

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The drive name of a CD drive can be anything from A-Z, not just D,E,F or G, moreover there can be more than one cd drive in a machine. If the installer program is started from the CD or DVD then you should determine the full path of your the installer executable and you get the answer immediately. If your installer is started from a different location than the packages (but why would someone do it like this???) for example from the hard drive then you have to search through all CD/DVD drivers for the installer packages. However I wouldn't restrict installation just from CD/DVD drives, sometimes it comes handy if you can install something from local packages.
To get the list of drives in the system use GetLogicalDriveStrings()[^] or GetLogicalDrives()[^].
To get the type of a drive use GetDriveType()[^].

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 4,643
CHill60 2,970
Maciej Los 2,348
Jochen Arndt 1,900
ppolymorphe 1,765

Advertise | Privacy | Mobile
Web02 | 2.8.170518.1 | Last Updated 23 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100