LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Virtual COM. Detect event

Hi.

I have a Virtual COM port that allow me to emulate an RS-232 on a USB port. This means that when i insert an appropriate external USB peripheral, a new COM port in my system appears.

I wold like to capture the operation system event generated when the exeternal peripheral is removed (and the COM port disappears). Otherwise i must do a polling (or wait for a write error) to know if the exeternal peripheral is still present, but i wouldn't....

Please help me!
0 Kudos
Message 1 of 2
(2,477 Views)
Hi,
you could use windows API to obtain this information, in particular you could pass trough the Microsoft SysInfo Control ActiveX.
This ActiveX can notify your program device add/remove events.

Take a look at these MSDN links for information

DeviceArrival Event
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinf98/html/scevtDeviceArrival.asp

DeviceRemoveComplete Event
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinf98/html/scevtDeviceRemoveComplete.asp

Looking for "ActiveX" in NI Example finder you'll find examples on registering activeX events.

With this been said, it could be a lot easier to create a subVI that calls "VISA Find Resource.vi" and look for added-deleted COM resources!

Ciao.

NicolaC
National Instruments
0 Kudos
Message 2 of 2
(2,444 Views)