Results 1 to 3 of 3

Thread: System.Management Mediatype Values?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    System.Management Mediatype Values?

    I ran accross this piece of code that uses the System.Management to get the free space on a drive for ONLY logical drives on Hard disks drives. It does this by check the Mediatype. Anybody know where I can find a listing of the Mediatype values? I would like to modify this to get free space only from USB flash drives.
    Code:
    Imports System.Management
    
    Private Sub frmSysTray_Load(blah blah blah)
    Dim MGMT As ManagementObject
    Dim Searcher As ManagementObjectSearcher
    Searcher = New ManagementObjectSearcher("SELECT * FROM Win32_LogicalDisk")
    For Each MGMT In Searcher.Get
    If Convert.ToString(MGMT("MediaType")) = "12" Then
    MsgBox(MGMT("DeviceID"))
    MsgBox(Convert.ToString(MGMT("Size")))
    MsgBox(Convert.ToString(MGMT("FreeSpace")))
    End If
    Next
    End Sub
    Apparently "12" is the Mediatype value for HDDs. Couldn't find anything about this with Google search, but I assume it has to be in MSDN documentation somewhere.

  2. #2
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: System.Management Mediatype Values?


  3. #3
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: System.Management Mediatype Values?

    MSDN library is the 1st resource you should look for. Just google for "win32_logicaldisk", and you'll find your answer in the 1st hit.

    http://msdn.microsoft.com/en-us/library/aa394173.aspx
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

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