What language or method would I use to listen to the event when a removeable drive is plugged into the PC?
A:
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
2008-10-02 07:56:04
Windows XP doesn't allow autorun's for removable devices.
E3
2008-10-02 07:57:13
It does. My pendrive has autorun on it and works like a charm (I'm using PortableApps).
Biri
2008-10-02 08:02:28
Really? It comes up with an 'autorun' dialog which allows you to select the action, but doesn't actually have any automatic file executions
E3
2008-10-02 15:11:10
A:
This article on codeproject.com is in C++, and has a solution using the shell change notify register function.
Darksider
2008-10-02 08:01:32
+2
A:
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.