0

I am using ManagementObjectSearcher to detect the availability of a bluetooth device:

ManagementObjectSearcher("select Name from Win32_PnPEntity WHERE Name = 'Microsoft Bluetooth LE Enumerator'")

I'd like to know as the application runs if such device is added or removed. Is there a way to do that without polling the query?

Frank Schwieterman
  • 24,142
  • 15
  • 92
  • 130

1 Answers1

1

You can create a ManagementEventWatcher and set up a method to handle the events when it occurs. Its described in this stackoverflow post

Using WMI to identify which device caused a Win32_DeviceChangeEvent

Paul G
  • 1,219
  • 7
  • 14