Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CDROM drive

CDROM drive

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 4 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cathy
    wrote on last edited by
    #1

    How can you find them?

    M N 2 Replies Last reply
    0
    • C Cathy

      How can you find them?

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      On the shelves at your local Best Buy. :) But seriously, call GetLogicalDrives() to determine the drive letters in use, then GetDriveType() on each drive. GetDriveType() returns DRIVE_CDROM for CD-ROM drives. --Mike-- http://home.inreach.com/mdunn/ The Signature, back by popular demand: Buffy. Pajamas.

      C 1 Reply Last reply
      0
      • M Michael Dunn

        On the shelves at your local Best Buy. :) But seriously, call GetLogicalDrives() to determine the drive letters in use, then GetDriveType() on each drive. GetDriveType() returns DRIVE_CDROM for CD-ROM drives. --Mike-- http://home.inreach.com/mdunn/ The Signature, back by popular demand: Buffy. Pajamas.

        C Offline
        C Offline
        Cathy
        wrote on last edited by
        #3

        Thanks! :) Have a great weekend!

        1 Reply Last reply
        0
        • C Cathy

          How can you find them?

          N Offline
          N Offline
          netsky
          wrote on last edited by
          #4

          This is an example: void GetCDROMDrive(void) { char buf[10]; BOOL bFind = FALSE; for (int i = 0;i < 24;i++) { if (bFind) break; sprintf(buf,"%c:\\",'C'+i); WORD type = GetDriveType(buf); switch(type) { case DRIVE_UNKNOWN: break; case DRIVE_NO_ROOT_DIR: break; case DRIVE_REMOVABLE: break; case DRIVE_FIXED: break; case DRIVE_REMOTE: break; case DRIVE_CDROM: //("CD-ROM"); lstrcpy(g_szCD_ROM,buf); break; case DRIVE_RAMDISK: break; default: break; }; } } welcome you to Sky...

          A 1 Reply Last reply
          0
          • N netsky

            This is an example: void GetCDROMDrive(void) { char buf[10]; BOOL bFind = FALSE; for (int i = 0;i < 24;i++) { if (bFind) break; sprintf(buf,"%c:\\",'C'+i); WORD type = GetDriveType(buf); switch(type) { case DRIVE_UNKNOWN: break; case DRIVE_NO_ROOT_DIR: break; case DRIVE_REMOVABLE: break; case DRIVE_FIXED: break; case DRIVE_REMOTE: break; case DRIVE_CDROM: //("CD-ROM"); lstrcpy(g_szCD_ROM,buf); break; case DRIVE_RAMDISK: break; default: break; }; } } welcome you to Sky...

            A Offline
            A Offline
            Andrew Peace
            wrote on last edited by
            #5

            Just a quick note about switch/case; if you've got this:

            switch (x)
            {
            case 0:
            break;
            case 1:
            break;
            case 2:
            MyFunction();
            break;
            case 3:
            MyFunction();
            break;
            case 4:
            MyOtherFunction();
            break;
            };

            You can write it mroe concisely as:

            switch (x)
            {
            case 0:
            case 1:
            break;

            case 2:
            case 3:
            MyFunction();
            break;

            case 4:
            MyOtherFunction();
            break;
            };

            You probably already knew, but for the purposes of anyone reading it may be useful info. > Andrew.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups