如何通过友好名称打开串口? [英] How to open a serial port by friendly name?

查看:14
本文介绍了如何通过友好名称打开串口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

友好名称 = 出现在设备管理器"中端口(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.

这篇关于如何通过友好名称打开串口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆