Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Windows
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 13:53pm
Gbenbam1.1K
Comments
Wes Aday at 23-Sep-12 19:00pm
   
Query the drive types

1 solution

Rate this: bad
good
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()[^].
  Permalink  
v2

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

  Print Answers RSS
0 Dnyaneshwar@Pune 719
1 CPallini 315
2 Sergey Alexandrovich Kryukov 310
3 Peter Leow 280
4 CHill60 235
0 Sergey Alexandrovich Kryukov 9,008
1 OriginalGriff 6,771
2 Peter Leow 4,262
3 Zoltán Zörgő 3,769
4 Richard MacCutchan 2,623


Advertise | Privacy | Mobile
Web04 | 2.8.150128.1 | Last Updated 23 Sep 2012
Copyright © CodeProject, 1999-2015
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