Good question. I did a bit of searching and found this:

http://msdn2.microsoft.com/en-us/library/aa363480.aspx

Apparently there is a WM_DEVICECHANGE message, which would be handled via a wndproc function (in C/C++). I haven't actually tried this, however...but it looks interesting.