VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Loop through all drives and determine type (hard disk, floppy, CDROM, network, etc)

by Anonymous (267 Submissions)
Category: Windows System Services
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Tue 29th December 1998
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Loop through all drives and determine type (hard disk, floppy, CDROM, network, etc)

API Declarations



Public Const DRIVE_CDROM = 5
Public Const DRIVE_FIXED = 3
Public Const DRIVE_RAMDISK = 6
Public Const DRIVE_REMOTE = 4
Public Const DRIVE_REMOVABLE = 2

Rate Loop through all drives and determine type (hard disk, floppy, CDROM, network, etc)



Dim strMessage As String
Dim intCnt As Integer

For intCnt = 65 To 86
    strDrive = Chr(intCnt)
    Select Case GetDriveType(strDrive + ":\")
           Case DRIVE_REMOVABLE
                rtn = "Floppy Drive"
           Case DRIVE_FIXED
                rtn = "Hard Drive"
           Case DRIVE_REMOTE
                rtn = "Network Drive"
           Case DRIVE_CDROM
                rtn = "CD-ROM Drive"
           Case DRIVE_RAMDISK
                rtn = "RAM Disk"
           Case Else
                rtn = ""
    End Select
    If rtn <> "" Then
        strMessage = strMessage & vbCrLf & "Drive " & strDrive & " is type: " & rtn
    End If
Next intCnt
MsgBox (strMessage)

Download this snippet    Add to My Saved Code

Loop through all drives and determine type (hard disk, floppy, CDROM, network, etc) Comments

No comments have been posted about Loop through all drives and determine type (hard disk, floppy, CDROM, network, etc). Why not be the first to post a comment about Loop through all drives and determine type (hard disk, floppy, CDROM, network, etc).

Post your comment

Subject:
Message:
0/1000 characters