Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Jun 13, 2000

Calling the CD-Rom

Question:
I would like to know how to call the CD-Rom, or rather search for its drive letter.

Answer:
You can use the FileSystemObject (Microsoft Scripting Runtime in the references dialog). Iterate through the Drives collection of the FileSystemObject and check its DriveType property and DriveLetter property. DriveType 4 is the CD ROM.

Set a reference to the Microsoft Scripting Runtime and try this code.

Dim objFso As New FileSystemObject
Dim objDrive As Drive
For Each objDrive In objFso.Drives
    With objDrive
        If .DriveType = CDRom Then
            MsgBox "CD ROM is " & .DriveLetter
        End If
    End With
Next objDrive
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap