valid drives

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David A. Osborn

    #1

    valid drives

    Is there a way to check if a drive is valid, both when you know the drive
    letter and when you want to get a listing of all valid drive letters?




  • 

    #2
    Re: valid drives

    | Is there a way to check if a drive is valid, both when you know the drive
    | letter and when you want to get a listing of all valid drive letters?

    yes.


    Comment

    • Cor Ligthert [MVP]

      #3
      Re: valid drives

      David,

      See this below, the style shows that it is not from me, however I don't know
      where I got it anymore.

      Imports System.Manageme nt
      \\\
      Dim searcher As New ManagementObjec tSearcher _
      ("SELECT * FROM Win32_LogicalDi sk")
      Dim ManObjOp As ManagementObjec t
      If searcher.Get.Co unt > 1 Then
      For Each ManObjOp In searcher.Get
      Dim win32 As String = "Win32_LogicalD isk='" &
      ManObjOp("Name" ).ToString & "'"
      Dim ManObjLogD As New ManagementObjec t(win32)
      For Each diskProperty As PropertyData In
      ManObjLogD.Prop erties
      If Not diskProperty.Va lue Is Nothing Then
      Console.WriteLi ne _
      ("{0} = {1}", diskProperty.Na me, diskProperty.Va lue)
      End If
      Next
      Next
      End If
      ///
      I hope this helps a little bit?

      Cor


      Comment

      • Dragon

        #4
        Re: valid drives

        GetLogicalDrive s API will give you a list of all currently available
        drives:

        Friend Declare Function GetLogicalDrive s Lib "kernel32.d ll" ( _
        ) As Int32

        Roman

        "David A. Osborn" <dosborn278@hot mail.com> ñîîáùèë/ñîîáùèëà â íîâîñòÿõ
        ñëåäóþùåå: news:sdwNe.2900 20$xm3.237012@a ttbi_s21...[color=blue]
        > Is there a way to check if a drive is valid, both when you know the[/color]
        drive[color=blue]
        > letter and when you want to get a listing of all valid drive letters?
        >
        >
        >
        >[/color]


        Comment

        • Ken Tucker [MVP]

          #5
          RE: valid drives

          Hi,

          In addition to Cor's comment you can use environment.get logicaldrives

          http://msdn.microsoft.com/library/de...rivestopic.asp

          Ken
          -------------------------

          "David A. Osborn" wrote:
          [color=blue]
          > Is there a way to check if a drive is valid, both when you know the drive
          > letter and when you want to get a listing of all valid drive letters?
          >
          >
          >
          >
          >[/color]

          Comment

          Working...