Using RegisterDeviceNotification in a .NET app
I have seen some examples on how to use RegisterDeviceNotification from the Windows API, but I have not seen any .NET examples. I want to write a C# app that is notified when a new drive appears (specifically through USB, firewire, etc). This app needs to be a Windows service, so I can't use WM_DEVICECHANGE messages without some bad-practice hacking. I'd like to avoid that. Can anyone give me a sample of how to use RegisterDeviceNotification in C#, or at least give me a good alternative to it? EDIT: Again, this is a Windows service that has no graphical user interface. So the possible