Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
1.00/5 (1 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
Comments
[no name] 23-Sep-12 19:00pm    
Query the drive types

1 solution

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()[^].
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900