VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get First CD Drive

by Dragan Ristić (1 Submission)
Category: Miscellaneous
Compatability: VB.NET
Difficulty: Unknown Difficulty
Originally Published: Tue 28th March 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Get First CD Drive

Rate Get First CD Drive



    Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As DRIVE_TYPE

    Private Enum DRIVE_TYPE As Integer
        DRIVE_CDROM = 5
        DRIVE_FIXED = 3
        DRIVE_NO_ROOT_DIR = 1
        DRIVE_RAMDISK = 6
        DRIVE_REMOTE = 4
        DRIVE_REMOVABLE = 2
        DRIVE_UNKNOWN = 0
    End Enum

    Public Function GetCDDrive()
        Dim LogicalDrives() As String = Directory.GetLogicalDrives
        Dim Drive As String
        For Each Drive In LogicalDrives
            If GetDriveType(Drive) = DRIVE_TYPE.DRIVE_CDROM Then
                Return (Drive)
            End If
        Next
    End Function

Download this snippet    Add to My Saved Code

Get First CD Drive Comments

No comments have been posted about Get First CD Drive. Why not be the first to post a comment about Get First CD Drive.

Post your comment

Subject:
Message:
0/1000 characters