private void GetSerialPort() //获取串口列表
{
RegistryKey keyCom = Registry.LocalMachine.OpenSubKey("Hardware\\DeviceMap\\SerialComm");
if (keyCom != null)
{
this.comBoxEdit1.properties.Items.clear();
string[] sSubKeys = keyCom.GetValueNames();
foreach (string sName in sSubKeys)
{
string sValue = (string)keyCom.GetValue(sName);
this.comBoxEdit1.properties.Add(sValue);
}
comBoxEdit1.SelectedIndex = 0;
}
}
c#——动态获取本机可用串口
最新推荐文章于 2024-05-29 11:20:12 发布