How to prevent autoplay and run my own app when inserting an USB-Flash drive

Posted by Thomas on Stack Overflow See other posts from Stack Overflow or by Thomas
Published on 2012-05-31T09:42:58Z Indexed on 2012/05/31 10:41 UTC
Read the original article Hit count: 271

Filed under:
|
|

when inserting an USB-Flash drive, Windows normally opens the Autoplay dialog that offers to browse the drive or if there are multimedia files it offers to choose an app to open them.

We developed a media player that is connected to the USB-Drive and registers itself as Mass Storage Device.

What I need is, that when inserting the Player that this Dialog is not shown, but instead my own application is launched.

Ideally the application would be on the Flash Drive itself, but as I understood is that Autorun is disabled for USB-Drives.

It would be enough if a preinstalled application is launched. I already tried to catch the WM_DRIVE_CHANGE message, but this only works if my application is the top most window, otherwise the Autoplay Dialog is displayed.

Best Tom

© Stack Overflow or respective owner

Related posts about Windows

Related posts about usb-drive