<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>

[{'answer_id': 11735, 'author': 'Brian Ensink', 'author_id': 1254, 'author_profile': 'https://Stackoverflow.com/users/1254', 'pm_score': 3, 'selected': True, 'text': '<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.</p>\n\n<p>The second approach requires inserting an object that implements the COM interface <code>IQueryCancelAutoPlay</code> COM interface into the Running Object Table.</p>\n'}, {'answer_id': 16703, 'author': 'Factor Mystic', 'author_id': 1569, 'author_profile': 'https://Stackoverflow.com/users/1569', 'pm_score': 0, 'selected': False, 'text': '<p>Alternatively, you could just programmatically save the current state of autoplay and turn it off when your program starts, then restore the original state when your program closes. This would be a lot simpler. Check out <a href="http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/regentry/93502.mspx?mfr=true" rel="nofollow noreferrer">the NoDriveTypeAutoRun key</a>.</p>\n'}]
['https://Stackoverflow.com/questions/11734', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1254/']