Results 1 to 3 of 3

Thread: Disk drives?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 1999
    Posts
    25

    Post

    Is there any way to search information about disk drives attached to your computer in VB.

    thanks in advance

    Jamppa

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    Try something like:
    Code:
    Private Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
    Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
    
    Private Const DRIVE_CDROM = 5
    Private Const DRIVE_FIXED = 3
    Private Const DRIVE_RAMDISK = 6
    Private Const DRIVE_REMOTE = 4
    Private Const DRIVE_REMOVABLE = 2
    
    Private Sub Form_Load()
        Dim sDrives As String
        Dim sDrive As String
        
        sDrives = Space(255)
        sDrives = Left$(sDrives, GetLogicalDriveStrings(255, sDrives))
        While Len(sDrives)
            sDrive = UCase(Left$(sDrives, 3) & Space(10))
            sDrives = Mid$(sDrives, 5)
            Select Case GetDriveType(Trim(sDrive))
            Case DRIVE_CDROM
                sDrive = sDrive & "CD-ROM"
            Case DRIVE_FIXED
                sDrive = sDrive & "HDD (Fixed)"
            Case DRIVE_RAMDISK
                sDrive = sDrive & "RAM Disk"
            Case DRIVE_REMOTE
                sDrive = sDrive & "Remote (Network)"
            Case DRIVE_REMOVABLE
                sDrive = sDrive & "Removable (Diskette)"
            Case Else
                sDrive = sDrive & "Unknown"
            End Select
            List1.AddItem sDrive
        Wend
    End Sub
    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]
    Certified AllExperts Expert

  3. #3
    Addicted Member
    Join Date
    Feb 2000
    Posts
    224

    Post

    But how do we differentiate the removable drive ???
    Is it a 1.44 MB floppy or a 1.2 MB thing ??
    or a 100MB Drive ??

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