views:

20

answers:

2

Hi,

I am using the following code to retrieve information about my local drive:

ManagementObject c_drive = new ManagementObject("win32_logicaldisk.deviceid=\"c:\"");
        c_drive.Get();
driveinfo_lbl.Text = "Type: " + c_drive["Mediatype"].ToString();

What I am curious about is "MediaType" - how do you convert that to something more meaningful than the number that is returned. I know you could do it with a struct, but I can't find where the listing is for each value?

Thanks, R.

A: 

According to the Managed Object Format code, the MediaType is a string. So I dont think you can get more out of it than that unless you parse it yourself.

SwDevMan81
This is the page for Win32_DiskDrive.
Odrade
c_drive["Mediatype"] returns a value of 12, I want to know if it is a removable media, logical drive etc. not a numerical value!
flavour404
+1  A: 

See this page, which defines the values for the MEDIA_TYPE enumeration used by Win32_LogicalDisk.

Odrade
Yeah, combined with a small array pretty much sorted that all out, thanks.
flavour404