How to open a serial port by friendly name?(如何通过友好名称打开串口?)
问题描述
友好名称 = 出现在设备管理器"中端口(COM 和 LPT)"下的名称.
friendly name = the name that appears in "Device Manager" under "Ports (COM & LPT).
下面提供了两种解决方案.一个使用 WMI,另一个使用 SetupAPI.
two solutions provided below. One with WMI and another with SetupAPI.
推荐答案
尝试在 Win32_SerialPort 类上运行 WMI 查询.下载 WmiCodeCreator试验并自动生成 C# 代码.
Try running a WMI query on the Win32_SerialPort class. Download WmiCodeCreator to experiment and auto-generate the C# code.
这篇关于如何通过友好名称打开串口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何通过友好名称打开串口?


- MoreLinq maxBy vs LINQ max + where 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 输入按键事件处理程序 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01