Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Notification to a running application of a USB device connecting to the computer.

Posted on 2013-01-25
3
Medium Priority
?
355 Views
Last Modified: 2013-01-28
hi - i'm using VS2010 and .net 4 running on Windows 7. I want my app to respond to a specific usb device being connected to the computer - while the app is running. is there an event that i can trap? can you provide some code that would show how the call back would work?
the usb device is of my making, so i have some control over the device protocol. however it uses the ftdi chip to control the enumeration, so i don't have control over the device driver. it instantiates as a USB serial device. The actual device is an Arduino Nano.
thanks,
0
Comment
Question by:jdcoburn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 7

Expert Comment

by:tipsybroom
ID: 38820796
0
 

Author Comment

by:jdcoburn
ID: 38820949
thanks, but this shows up as a serial device (COM port). i suppose i could scan for a new COM port using the serial.ports but i would rather try and get a notification.
0
 
LVL 4

Accepted Solution

by:
jiangsheng earned 2000 total points
ID: 38822480
There's a device change notification via the Win32_DeviceChangeEvent WMI provider. However, this provider doesn't really tell if a new device is connected via USB right away.  You can enumerate USB devices via Win32_USBControllerDevice and see what's changed.

It may be easier to just pinvoke RegisterDeviceNotification and pass GUID_DEVINTERFACE_USB_DEVICE as the filter's class type.
0

Featured Post

AWS Certified Solutions Architect - Associate

This course has been developed to provide you with the requisite knowledge to not only pass the AWS CSA certification exam but also gain the hands-on experience required to become a qualified AWS Solutions architect working in a real-world environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question