Results 1 to 2 of 2

Thread: Get letter of CD-ROM Drive

  1. #1

    Thread Starter
    Hyperactive Member Matt-D's Avatar
    Join Date
    Nov 1999
    Location
    Mettmann, Germany
    Posts
    305

    Post

    English:
    My program starts an other application form a CD (because it's bigger than a 1,44 M disk).
    But the users have different CD drive names. So I want that the text of a textbox is the letter of the CD-drive.

    Is this possoble (in VB3, but normally this doesn't matter.)????
    Matt


    Deutsch:
    Mein Programm startet ein Unterprogramm, das aus Platzgründen auf einer CD-ROM ist. Doch haben die meisten Benutzer verschiedene Laufwerksbezeichnungen. Deshalb möchte ich, daß der Buchstabe des CD-Laufwerks in einem Textfeld erscheint.

    Ist das möglich ? (VB3, aber normalerweise stört das nicht)
    Matthias

  2. #2
    Guest

    Post

    hmm, i dont know much about VB3 but if you are able to use the API, try this....

    Code:
    Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
    
    Private Sub Form_Load()
        'Get information about the C:\
        Select Case GetDriveType("C:\")
            Case 2
                Me.Print "Removable"
            Case 3
                Me.Print "Drive Fixed"
            Case Is = 4
                Me.Print "Remote"
            Case Is = 5
                Me.Print "Cd-Rom"
            Case Is = 6
                Me.Print "Ram disk"
            Case Else
                Me.Print "Unrecognized"
        End Select
    End Sub
    near the top of the code it looks at the "C:" drive, simply cycle throught the alphabet until you get to a CD-Rom drive, and BINGO!

    ------------------

    Wossname,
    Email me: wossnamex@talk21.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width