New to WMI, and I feel a little in the dark,
The following code detects the connection and disconnection of USB devices, but I also need to determine when the BT device is connected / disconnected (and not just paired).
ManagementEventWatcher watcher = new ManagementEventWatcher(); WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_DeviceChangeEvent WHERE EventType = 2 OR EventType = 3"); watcher.EventArrived += new EventArrivedEventHandler(HardwareDeviceChange); watcher.Query = query; watcher.Start();
If this is not possible for WMI, is there any other way I could do this (hopefully avoiding 32-bit solutions if at all possible).
source share