DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Check the CD label

  1. #1
    Miroslav St. Jeliazkov Guest

    Check the CD label

    Hi everyone,

    I have a project which must check the CD label before reading any
    information from it.

    I have to check what drive is the first CD and than its label.

    Can someone help me with that. Any example or even tip will be usefull.

    Thanks in advance!

    Miro



  2. #2
    Rick Rothstein Guest

    Re: Check the CD label

    GET CDROM (OR ANY DRIVE) LABEL
    ================================
    VolumeName = Dir("c:", vbVolume)

    Note: The drive letter must be followed by a colon at
    minimum (anything after that appears to be ignored).


    TO GET CDROM DRIVE LETTER
    ================================
    Paste this into the Form's code window or into a BAS module:

    Private Declare Function GetDriveType Lib "kernel32" _
    Alias "GetDriveTypeA" _
    (ByVal sDrive As String) As Long

    Function AvailableCDs() As String
    On Error Resume Next
    For X = Asc("d") To Asc("z")
    If GetDriveType(Chr$(X) & ":") = 5 Then
    AvailableCDs = AvailableCDs & Chr$(X)
    End If
    Next
    End Function

    An example call to this would be ==> MsgBox AvailableCDs

    Please note that it is possible for a user to have more than one CD on their
    system. If the return value from the AvailableCDs function has a length one,
    then the letter returned is the only CD on the system. If the return value
    has a greater length, then you will have to ask the user which CD they are
    using (offering the letters returned from the function to choose from).


    Rick



    "Miroslav St. Jeliazkov" <jeliaskoff@earthling.net> wrote in message
    news:394dd9fe@news.devx.com...
    > Hi everyone,
    >
    > I have a project which must check the CD label before reading any
    > information from it.
    >
    > I have to check what drive is the first CD and than its label.
    >
    > Can someone help me with that. Any example or even tip will be usefull.
    >
    > Thanks in advance!
    >
    > Miro
    >
    >




  3. #3
    Miroslav St. Jeliazkov Guest

    Re: Check the CD label

    Thanks Rick, I'll try it but I'm sure it works!

    Thanks again for the help!

    Miro
    > GET CDROM (OR ANY DRIVE) LABEL
    > TO GET CDROM DRIVE LETTER





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center