C#通过注册表获取电脑的可用COM串口列表
C#获取串口列表
//using Microsoft.Win32; 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); } } }
转 :https://www.cnblogs.com/southhuachen/p/5117528.html
https://blog.csdn.net/BYH371256/article/details/83346490