Results 1 to 3 of 3

Thread: Finding Default CDROM Drive

  1. #1
    Guest

    Question

    Hello,

    Does anyone have any code to find the default CDROM drive letter???

    Thanks in advance.

    Anthony

  2. #2
    Hyperactive Member scuzymoto's Avatar
    Join Date
    Aug 1999
    Location
    Washington State
    Posts
    316
    I got this out of the MSDN help library...

    Code:
    Sub ShowDriveType(drvpath)
        Dim fs, d, s, t
        Set fs = CreateObject("Scripting.FileSystemObject")
        Set d = fs.GetDrive(drvpath)
        Select Case d.DriveType
            Case 0: t = "Unknown"
            Case 1: t = "Removable"
            Case 2: t = "Fixed"
            Case 3: t = "Network"
            Case 4: t = "CD-ROM"
            Case 5: t = "RAM Disk"
        End Select
        s = "Drive " & d.DriveLetter & ": - " & t
        MsgBox s
    End Sub
    SCUZ

  3. #3
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357
    Here's another way using the FileSystemObject.

    Make sure you reference Microsoft Scripting Runtime in your Project/References...

    Code:
        Dim loDrive As Drive
        Dim loFileSys As FileSystemObject
        Dim lsDriveLetters As String
        
        lsDriveLetters = "CDRom Drives are:" & vbNewLine
        Set loFileSys = New FileSystemObject
        
        For Each loDrive In loFileSys.Drives
            If loDrive.DriveType = CDRom Then
                lsDriveLetters = lsDriveLetters & loDrive.DriveLetter & vbNewLine
            End If
        Next
        
        MsgBox lsDriveLetters
    ~seaweed

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