<p>I am developing an application to install a large number of data files from multiple DVDs.  The application will prompt the user to insert the next disk, however Windows will automatically try to open that disk either in an explorer window or ask the user what to do with the new disk.<br>
How can I intercept and cancel auto play messages from my application?</p>

There are two approaches that I know of.  The first and simplest is to register the special Windows message "QueryCancelAutoPlay" and simply return 1 when the message is handled.  This only works for the current window, and not a background application.
The second approach requires inserting an object that implements the COM interface
```
IQueryCancelAutoPlay
```
COM interface into the Running Object Table.