Click here to Skip to main content
15,790,267 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have i windows service,which take care of USB devices arrival and removal.

Plz help me out

What I have tried:

I able to figure all the USB device. But NOT printers.
Updated 7-Mar-17 22:39pm
[no name] 14-Jul-16 14:12pm    
You can determine the device class for an USB device. How to do you will easely find with Google. Here you will find an overview for device classes: USB - Wikipedia, the free encyclopedia[^]
sekharsam 14-Jul-16 14:24pm    
Thanks for ur reply , that i have already checked out but how to implement it

1 solution

Assuming you are using RegisterDeviceNotification function (Windows)[^] you can register the notification for specific device classes (see Registering for Device Notification (Windows)[^]).

See System-Defined Device Setup Classes Available to Vendors - Windows 10 hardware dev[^] for a list of device class GUIDs:
Class = Printer
ClassGuid = {4d36e979-e325-11ce-bfc1-08002be10318}
This class includes printers.
Share this answer
sekharsam 2-Feb-17 12:41pm    
sekharsam 8-Mar-17 3:41am    
Jochen Arndt
IO had used the Above ClsaaGuid, but the Device is not captured.
Jochen Arndt 8-Mar-17 4:13am    
An alternative method to get the ClassGuid of a specific device is opening the INF file for that device with a text editor (from the driver media or at Windows\inf for installed devices) or selecting it in the device manager and choosing ClassGUID on the Details tab.

If that does not help you may also try to catch all events to find out which is for your device.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900