Enumerate ALL CD-drives

This is a discussion on Enumerate ALL CD-drives within the Windows Programming forums, part of the Platform Specific Boards category; I'd like to enumerate all cd drives that are present on a computer, with letters and descriptions, and including ALL ...

  1. #1
    Steph
    Guest

    Enumerate ALL CD-drives

    I'd like to enumerate all cd drives that are present on a computer, with letters and descriptions, and including ALL kind of drive type, in example :
    E - TEAC CR-D/RW 10/12/32 rev 10.B
    F - MITSUMI CD-ROM FX4830T!B
    G - IBM DVD-ROM 1220 a

    etc...
    How can I do that ??
    Thanks in advance !

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    GetLogicalDriveStrings to find all drives

    GetDriveType to see if it's a CD Rom

    GetVolumeInformation will give some info on the drive details....

  3. #3
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,263
    I'm feeling generous! Have some code:-
    Code:
    // cDriveLetter is a global - "char cDriveLetter;"
    int GetCDDrive(void)
    {
    	DWORD dwDrives;
    	int i;
    	char szDrive[4];
    
    	dwDrives = GetLogicalDrives();
    	for (i=0;i<32;i++)
    	{
    		if (dwDrives & 1)
    		{
    			wsprintf(szDrive, "%c:\\", 65 + i);
    			if (GetDriveType(szDrive) == DRIVE_CDROM)
    			{
    				cDriveLetter = 65 + i;
    				return TRUE;
    			}
    		}
    
    		dwDrives >>= 1;
    	}
    	
    	return FALSE;
    }
    That'll get you the first CD-ROM drive in a system. All you need to do is extend it slightly by including GetVolumeInformation and enumerating through all drives and you're done. Have fun!

  4. #4
    Steph
    Guest
    Well, what can I say ? Thankx to you all for these great information ! It sure will help me a lot !

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Nested for loop...search & display a list within a list
    By chadsxe in forum C++ Programming
    Replies: 13
    Last Post: 07-20-2005, 01:34 PM
  2. HUGE fps jump
    By DavidP in forum Game Programming
    Replies: 23
    Last Post: 07-01-2004, 10:36 AM
  3. SCSI drivers... device conflict... no CD drives
    By CodeMonkey in forum Tech Board
    Replies: 2
    Last Post: 09-10-2003, 06:48 AM
  4. CD Drives
    By confuted in forum A Brief History of Cprogramming.com
    Replies: 29
    Last Post: 06-11-2003, 08:06 PM
  5. Probs with CD drives
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 03-11-2002, 10:09 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21