如何在C#中使用COM端口禁用/启用USB? [英] How to disable/enable the USB using COM port in C#?

查看:673
本文介绍了如何在C#中使用COM端口禁用/启用USB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在设备运行时启用和禁用 USB端口。我创建虚拟串行通信(COM1-> COM2)和(COM2-> COM1)。此串行端口用于发送发送和接收通信应用程序。当这种类型的通信发生时,我尝试启用和禁用具有受尊重的COM端口的设备。但是当串行端口运行时,那个时间USB无法禁用和启用设备。如何在应用程序运行或连接时禁用/启用USB设备?



我尝试过:



i尝试使用受尊重的COM端口启用和禁用设备。但是当串行端口正在运行时,那时USB无法禁用和启用设备。

i am trying to enable and disable the USB port when the device is running. i create virtual serial communication(COM1->COM2) and (COM2->COM1). this serial port to make send and receive communication application.when this type of communication are happen,i trying to do enable and disable the device with respected COM port.but when the serial port are running,that time USB not able to disable and enable the device.how to i disable/enable the USB device when application running or connection time?

What I have tried:

i trying to do enable and disable the device with respected COM port.but when the serial port are running,that time USB not able to disable and enable the device.

推荐答案

您是否尝试过Google搜索?



这个:如何在C#中使用COM端口禁用/启用USB - Google搜索 [ ^ ]



找到:

* c# - 以编程方式启用/禁用设备的Win32 API函数 - 堆栈溢出 [ ^ ]

* 使用C#启用/禁用USB端口 [ ^ ]

* 如何禁用usb por在C#中[ ^ ]
Did you try Google Search?

This: How to disable/enable the USB using COM port in C# - Google Search[^]

Found:
* c# - Win32 API function to programmatically enable/disable device - Stack Overflow[^]
* Enable/Disable USB Port using C#[^]
* How to disable usb port in C#[^]


无法禁用正在使用的设备。您必须先关闭端口才能禁用它。
Devices which are in use can not be disabled. You have to close the port before you can disable it.


这篇关于如何在C#中使用COM端口禁用/启用USB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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