编程语言 程序设计交流站


Join the forum, it's quick and easy

编程语言 程序设计交流站
编程语言 程序设计交流站
Would you like to react to this message? Create an account in a few clicks or log in to continue.
编程语言 程序设计交流站

欢迎关顾本站,在这里你可以畅所欲言,提出你要解决的问题,各路高手会给你一个圆满的答复,另外有各种源代码、源程序等供你下载。vb vc c++ c# delphi 易语言 Java PASCAL VFP JS VBS Pascal SQL...>


您没有登录。 请登录注册

【Microsoft官方】VB.NET如何获取串口的名字

向下  留言 [第1页/共1页]

Admin

Admin
Admin


VB.NET如何获取串口的名字

比如我的USB转串口在电脑的设备管理器里面显示的是,Prolific USB-to-Serial Comm Port(com5),我如何能获取Prolific USB-to-Serial Comm Port(com5),整个的字符串,而不是COM5,这个简单的字串, SerialPort.GetPortNames,只能得到COM5,而不能得到前面的字符串

////////////////////////////////////////////////////////////////////////////////////


你好:

你可以尝试使用wmi查询设备名称。

或使用下列代码:
Dim searcher As New ManagementObjectSearcher("SELECT * FROM Win32_PnPEntity ")
For Each mgt As ManagementObject In searcher.[Get]()
If mgt("Name").ToString().IndexOf("COM5") > 0 Then
Console.WriteLine(mgt("Name"))
'mgt("Name")就是你要的名称
End If
Next

http://www.sudu.cn/info/html/edu/20071226/26239.html
http://blog.sina.com.cn/s/blog_4bab7f3f010009xo.html
http://www.cnblogs.com/emosen/archive/2008/07/25/1251108.html

http://proj.my-rpg.com

返回页首  留言 [第1页/共1页]

您在这个论坛的权限:
不能在这个论坛回复主题