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.
Re: System.Management Mediatype Values?
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