使用C#获取USB端口数 [英] Get Number of USB Ports using C#

查看:469
本文介绍了使用C#获取USB端口数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用C#中的编程来获取PC中所有可用USB端口的总数?

I want to get total no of all the available USB ports in my PC using programming in C#?

推荐答案

试试这个



Try this

Well, after studying several forums, I discovered that the com port associated to the USB/RS485 adapter is listed if I run the query SELECT * FROM Win32_PnPEntity .

But I really don't understand why the serial port of the arduino is shown by a query and the other port with the other query.... I mean, those are both uSB<->serial adapters!














OR

Maybe you can use a C# to USB device library as described here:
Are there any good C# to usb device libraries?

From the above answer: For getting a list of devices connected:
http://code.google.com/p/usb-devices-list/


这篇关于使用C#获取USB端口数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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