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#
  4. Accessing resource on unknown CD-ROM (drive letter).

Accessing resource on unknown CD-ROM (drive letter).

Scheduled Pinned Locked Moved C#
questionlearning
4 Posts 2 Posters 0 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.
  • T Offline
    T Offline
    TrooperIronMan
    wrote on last edited by
    #1

    Say some of our program resource is on CD, but we don't know which one (and want to use any available), what is best way to check available drives, and then check if disk we want is one of them?

    L 1 Reply Last reply
    0
    • T TrooperIronMan

      Say some of our program resource is on CD, but we don't know which one (and want to use any available), what is best way to check available drives, and then check if disk we want is one of them?

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      If using .NET 2.0 there is System.IO.DriveInfo which gives you: - all the drive letters - so scan them one by one, and for each drive - check drive type (check for DriveType.CDRom) - check volume label (check for your CD's label). If using .NET 1.1 you can follow the same scheme, but you would need PInvoke to Win32 functions such as GetVolumeInformation (And that's exactly what I did today !) :)

      Luc Pattyn

      T 2 Replies Last reply
      0
      • L Luc Pattyn

        If using .NET 2.0 there is System.IO.DriveInfo which gives you: - all the drive letters - so scan them one by one, and for each drive - check drive type (check for DriveType.CDRom) - check volume label (check for your CD's label). If using .NET 1.1 you can follow the same scheme, but you would need PInvoke to Win32 functions such as GetVolumeInformation (And that's exactly what I did today !) :)

        Luc Pattyn

        T Offline
        T Offline
        TrooperIronMan
        wrote on last edited by
        #3

        Visual C# 2005 EE so it's 2.0, I'll try that now...

        1 Reply Last reply
        0
        • L Luc Pattyn

          If using .NET 2.0 there is System.IO.DriveInfo which gives you: - all the drive letters - so scan them one by one, and for each drive - check drive type (check for DriveType.CDRom) - check volume label (check for your CD's label). If using .NET 1.1 you can follow the same scheme, but you would need PInvoke to Win32 functions such as GetVolumeInformation (And that's exactly what I did today !) :)

          Luc Pattyn

          T Offline
          T Offline
          TrooperIronMan
          wrote on last edited by
          #4

          OK got it thanks... link for good example on that: http://msdn2.microsoft.com/en-us/library/system.io.driveinfo.getdrives.aspx

          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