Trigger/Event when a usb thumb drive is inserted? (vista)

  • Thread starter Thread starter kilik3000
  • Start date Start date
K

kilik3000

Is there a way to catch an event/trigger that *might* be fired when a
usb thumb drive is inserted into a Vista PC?

The reason I ask is that I'd like to catch that event and back up the
content of the thumb drive to the local machine with a custom process.

I realize there might be some security issues with this...but it would
sure be useful if I could do it.

-Thx
 
Is there a way to catch an event/trigger that *might* be fired when a
usb thumb drive is inserted into a Vista PC?

The reason I ask is that I'd like to catch that event and back up the
content of the thumb drive to the local machine with a custom process.

I realize there might be some security issues with this...but it would
sure be useful if I could do it.

Look into Autoplay. When the USB drive or CD or other media is inserted a
list of apps appears. You can get your app added to this list and the user
can decide whether to have your app run always or have it as an option. The
WIA sdk that can be downloaded from MS will allow you to easily add your app
to this list.
 
Michael C said:
Look into Autoplay. When the USB drive or CD or other media is inserted a
list of apps appears. You can get your app added to this list and the user
can decide whether to have your app run always or have it as an option.
The WIA sdk that can be downloaded from MS will allow you to easily add
your app to this list.

Good if you want to run an app for a particular thumb drive being inserted.

If you want to detect *any* removable USB drive, override WndProc and listen
for WM_DEVICECHANGE. You get a DEV_BROADCAST_VOLUME structure which tells
you the drive letter.

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