Showing results for 
Search instead for 
Did you mean: 

How to catch an event when USB device is plug-ed / unplug-ed?

I want to register for an event that is generated when user unplugs / plugs USB device into PC. I saw solutions in other languages like Delphi and C++ but cannot find a way in Labview...

I don't want to check for devices in a loop, I want to have event generated automatically when this happens.




0 Kudos
Message 1 of 7

I suspect you will need to use a .NET event that calls a callback VI and have that VI send a user event to your events case.


I would start with this Stackoverflow thread:

And try to implement roughly what that person did in, but in LabVIEW using .NET nodes.  


This is likely the .NET class to use:


0 Kudos
Message 2 of 7

Any other hint or maybe even VI that does this?

0 Kudos
Message 3 of 7

USB Event Wql Event.png


You'd have to fiddle a bit with the 'e' object to get useful info, but it's a start...

Download All
Message 4 of 7

What about continuously checking visa find resource results for changes?

0 Kudos
Message 5 of 7

Thank you, but could you please save this two VIs in 2019 version? Thanks very much

0 Kudos
Message 6 of 7

Thanks  wiebe@CARYA for the soultion, i was trying something similar but your solution works fine.


Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
0 Kudos
Message 7 of 7