-1

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

atomicharri
  • 2,445
  • 5
  • 22
  • 23

3 Answers3

4

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.

user22044
  • 216
  • 1
  • 3
0

Is your program going to be running as a windows service and waiting? or is putting a startup script on the removable drive an option in this case?

Dean Rather
  • 31,756
  • 15
  • 66
  • 72
0

This article on codeproject.com is in C++, and has a solution using the shell change notify register function.

EggyBach
  • 4,148
  • 1
  • 18
  • 21