参考VC方法实现的:
public void GetComList()
{
RegistryKey keyCom = Registry.LocalMachine.OpenSubKey("Hardware//DeviceMap//SerialComm");
if (keyCom != null)
{
string[] sSubKeys = keyCom.GetValueNames();
this.cmbComPort.Items.Clear();
foreach(string sName in sSubKeys)
{
string sValue = (string)keyCom.GetValue(sName);
this.cmbComPort.Items.Add(sValue);
}
}
}