IQueryCancelAutoPlay interface (shobjidl.h)

Exposes a method that programmatically overrides AutoPlay or AutoRun. This allows you to customize the location and type of content that is launched when media is inserted.

Inheritance

The IQueryCancelAutoPlay interface inherits from the IUnknown interface. IQueryCancelAutoPlay also has these types of members:

Methods

The IQueryCancelAutoPlay interface has these methods.

 
IQueryCancelAutoPlay::AllowAutoPlay

Determines whether to play media inserted by a user and if so using what restrictions.

Remarks

Note  IQueryCancelAutoPlay is intended only for use by user-launched applications that are currently running. It should not be handled by invisible or background service applications to prevent the normal AutoPlay/AutoRun feature from being invoked. Giving the user a choice of what happens when media and devices are inserted into the system is a key feature of the platform. This feature is designed specifically to improve and personalize the user experience and should not be inhibited by background services.
 
A valid use of IQueryCancelAutoPlay is illustrated in the following scenario: Assume that you have, through AutoPlay, previously designated application A to handle video camera events. For video editing, however, you prefer application B. You open application B, begin editing some previously filmed video, and then decide to add some new content to the video being edited. Application B's import function prompts you to turn on the video camera so that the new content can be accessed. Normally, this video device activation would trigger the launch of the device-associated application A. Fortunately, using IQueryCancelAutoPlay, application B has canceled AutoPlay processing of video camera events while you are editing video content. In this case, the cancellation of Autoplay by application B has created a better user experience.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header shobjidl.h

See also

Autoplay in Windows XP: Automatically Detect and React to New Devices on a System