The problem with using the driver is that you need permission to install it, but otherwise I think this is the safest method.
In user space, you can try to create a window hook that will work if such an application uses windows, but otherwise is pretty unpleasant.
Alternatively, you can try using WMI , which is the underlying technology used in C #. You can search for pointers in this anwers and examples .
source share