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 12:53pm
Gbenbam873
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 Sergey Alexandrovich Kryukov 360
1 Abhinav S 260
2 Nirav Prabtani 252
3 Dave Kreskowiak 155
4 Pikoh 140
0 OriginalGriff 7,545
1 Sergey Alexandrovich Kryukov 6,757
2 Maciej Los 3,909
3 Peter Leow 3,693
4 CHill60 2,712


Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 23 Sep 2012
Copyright © CodeProject, 1999-2014
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