C#獲取本機可用串列埠
阿新 • • 發佈:2019-01-09
http://outofmemory.cn/code-snippet/2574/c-get-benji-keyong-chuankou
public void GetComList() { RegistryKey keyCom = Registry.LocalMachine.OpenSubKey("Hardware\DeviceMap\SerialComm"); if (keyCom != null) { string[] sSubKeys = keyCom.GetValueNames(); this.comboBox3.Items.Clear(); foreach (string sName in sSubKeys) { string sValue = (string)keyCom.GetValue(sName); this.comboBox3.Items.Add(sValue); } } }