如何确定USB端口是否可用? [英] How to determine USB Port is available for use or not?

查看:146
本文介绍了如何确定USB端口是否可用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发C#应用程序,该应用程序需要查找是否可以免费使用任何USB端口.

I am developing C# application which needs to find any USB port is free for use or not.

是否有任何C#类或WMI查询来确定USB端口是否免费使用?

Is there any C# class or WMI query to determine USB Port is free for use or not?

假设,
如果计算机上有5个USB端口,而其中2个已经被鼠标占用,则键盘
其余3个是免费的.
因此,我需要确定这些未使用的端口.

Suppose,
If a machine has 5 USB ports and out of which 2 are already occupied by mouse ,keyboard
and remaining 3 are free.
So I need to identify these ports which are not in use. 

此致

阿莫尔

推荐答案

下面是我们可以实现此目标的两个类.

Below are the two classes through which we can achieve this..

DriveInfo类

DriveType枚举


如果您将任何有用的条目标记为有帮助的条目,并且该条目回答了您的问题,请在答案"链接中进行标记.

It would be greatly appreciated if you would mark any helpful entries as helpful and if the entry answers your question, please mark it with the Answer link.

  ;


这篇关于如何确定USB端口是否可用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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