English 中文(简体)
C# remountUS装置 [复制]
原标题:C# remount USB devices [duplicate]
  • 时间:2012-01-15 04:07:07
  •  标签:
  • c#
  • usb
This question already has answers here:
Closed 11 years ago.

Possible Duplicate:
How to programatically unplug & replug an arbitrary USB device?

I have a USB device that sometimes gets lost (just doesn t work anymore, probably because the driver or the product itself is not so good). however, an application I write relies on this device. what i need to do to get the device working again is plugging it out and in again.

I want to know whether i can do that somehow automatically from my C# application? like disabling and reenabling the usb port?

问题回答

From what I understand, under windows, you might not be able to physically simulate the device remove and plug in back, but you can try disable the device and then enable it.

参看SetaupApi.dll。

regarding how to do that in C# you can take a look at the following link

https://stackoverflow.com/questions/1438371/win32-api--api----api-Function-to-programally-enable-disable-device>Win32





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签