private void Form1_Load(object
sender, EventArgs e)
{
ManagementObjectSearcher mos = new ManagementObjectSearcher("SELECT * FROM Win32_CDROMDrive");
foreach (ManagementObject
mo in mos.Get())
{
comboBox1.Items.Add(mo["Caption"].ToString());
}
}
private void btnGetCapability_Click(object
sender, EventArgs e)
{
Dictionary<UInt16, string>
list = new Dictionary<UInt16, string>();
list.Add(0, "Unknown");
list.Add(1, "Other");
list.Add(2, "Sequential Access");
list.Add(3, "Random Access");
list.Add(4, "Supports Writing");
list.Add(5, "Encryption");
list.Add(6, "Compression");
list.Add(7, "Supports Removable Media");
list.Add(8, "Manual Cleaning");
list.Add(9, "Automatic Cleaning");
list.Add(10, "SMART Notification");
list.Add(11, "Supports Dual-Sided Media");
list.Add(12, "Ejection Prior to Drive Dismount Not Required");
ManagementObjectSearcher
mos;
mos = new
ManagementObjectSearcher("Select * from Win32_CDROMDrive where
Caption='" + comboBox1.SelectedItem.ToString() + "'");
foreach
(ManagementObject mo in mos.Get())
{
UInt16[]
x = (UInt16[])mo["Capabilities"];
foreach(UInt16 i in x)
{
listBox1.Items.Add(list[i].ToString());
}
}
}