SharpAffair
SharpAffair

Reputation: 5478

Memory Card Information

I'm detecting the insertion of memory cards (removable media). Can I get information about the inserted media - type, manufacturer, etc?

Upvotes: 0

Views: 157

Answers (1)

Nick
Nick

Reputation: 5955

You ought to be able to use WMI to query the Win32_PhysicalMedia type and get the information you want.

Here is a basic code example of how to do a general query on the class:

ManagementObjectSearcher searcher = new
    ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia");

foreach (ManagementObject wmiObject in searcher.Get())
{
    if (wmiObject["Manufacturer"] == null)
        Console.WriteLine("Unknown");
    else
        Console.WriteLine(wmiObject["Manufacturer"].ToString());
}

Upvotes: 1

Related Questions