您的位置:首页 > 编程语言 > C#

C#获取串口列表

2007-08-24 14:51 323 查看
参考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);
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: