Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Getting list of CD-ROM drives

Posted on 1999-07-13
3
Medium Priority
?
239 Views
Last Modified: 2010-04-02
Does anyone know how to get a list of drive letters for all the CD-ROM drives under Windows 95 using VC6?

Can't seem to find anything in MSDN...

Thanks.
0
Comment
Question by:Gumpy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 1360 total points
ID: 1199918
Use GetLogicalDrives() and GetDriveType()

details follow.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1199919
GetLogicalDrives() returns a 32 bit value (DWORD) that is a bitmask of the drives that are defined on the computer.  each bit that is set to 1 indicates a drive that is defined.  i.e if the low bit is set, then there is a drive A and so on.  Use this to determine what drive letters are available.

Once you know what drive letters are available, use GetDriveType() to determine which of those drives are a CDROM.  It returns DRIVE_CDROM for a cd ROM.

continues.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1199920
DWORD DrvMsk = GetLogicalDrives();
char DrvLtr;
char DrvPth = "A:\\";

for (DrvLtr = 'A'; DrvLtr <= 'Z'; ++DrvLtr) // For each letter.
{
   if (DrvMsk & 1) // If drive is defined, then
   {
       DrvPth[0] = DrvLtr; // Store drive letter in path string.
       if (GetDriveType(DrvPth) ==  DRIVE_CDROM)
          DoSomething();
   }
   DrvMsk >>= 1; // shift next bit to low bit.
}
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

662 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question