views:

140

answers:

2

In an application we would like to control the windows pop-up messages that appear when a new USB drive is connected to the system.

Ideally, the dialog box should be completely hidden.

Any messages that could help?

Update

I know the trick to globally disable autoplay, but I'd rather control the behavior on a per event, per device basis in my application.

A: 

You can disable AutoPlay on all drives using GPEdit.msc. It would correspond to a registry key, so you could add that key and remove it as needed.

Here is an article that describes it. The instructions look like they are for XP. If you have Vista, then it is in Administrative Templates/Windows Components/AutoPlay Policies.

What I would try to just a per-device basis, would be to put the device in, while running Process Monitor. See which registry keys are being touched. I'd think that there would be one that correlates to the device id of the drive. You could then go and prepopulate that info with the correct setting.

Rob Haupt
Yeah, thanks. I knew that already, but I would like to control this behavior on a per-device basis in my application, not globally.
Ber
A: 

Selectively disabling autoplay is possible by using the QueryCancelAutoPlay message or the IQueryCancelAutoPlay interface. See this answer or this MSDN article for details.

Josh Kelley