I an trying to write a simple Windows Service that shall detect any incoming USB device and Launch a GUI application.
WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_VolumeChangeEvent WHERE EventType = 2");
watcher.EventArrived += watcher_EventArrived;
watcher.Query = query;
watcher.Start();
watcher.WaitForNextEvent();
This solution works well in Win 7 However, it fails in XP (I have XP SP3).
I found another solution here
http://www.codeproject.com/Articles/63878/Enumerate-and-Auto-Detect-USB-Drives
This works very well in windows forms application even on windows XP, However it fails when I put it in service even on Win 7
Can you please help?
EDIT 1: Presently there is no solution that works on win XP when we put the code in windows service.
Kind Regards
Bharat