Search code examples
windowseventsdrivelisten

What language/methods to use to listen to removeable drives in Windows?


What language or method would I use to listen to the event when a removeable drive is plugged into the PC?


Solution

  • I guess any language that can work with the Windows API should do. Basically, you listen to the windows message WM_DEVICECHANGE. This alone will let you listen to system-wide messages.

    For more specific scenarios look at the API function RegisterDeviceNotification(). Needless to day, C/C++ would be straightforward for this task.