我知道那里存在有关在设备管理器上收集设备的友好名称的问题,但是我不能这样做,因为该设备被简称为“ Stardard蓝牙链接(COM)串行”,并且我有许多虚拟端口相同的参考。我希望设备的名称显示在“设备和打印机”窗口上:
我正在用C#进行此操作,当前只是获取系统上可用COM端口的列表,然后从内存中选择我知道的端口。
我设法使用32Feet.Net使它工作。
您可以通过以下方式搜索设备
BluetoothClient client = new BluetoothClient();
devices = client.DiscoverDevicesInRange();
foreach (BluetoothDeviceInfo d in devices)
{
items.Add(d.DeviceName);
}
这将提供您在“设备和打印机”窗口上看到的友好名称的列表,而不是“ Bluetooth Link上的标准串行”。
如果您想要像我这样的COM端口或任何其他信息,则可以简单地执行WMI查询,例如
System.Management.ManagementObjectSearcher Searcher = new System.Management.ManagementObjectSearcher("Select * from WIN32_SerialPort");
foreach (System.Management.ManagementObject Port in Searcher.Get())
{
//your comparison or code here
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句