Your application must be running in the foreground window. The following code fragments illustrate how to set up and handle this message.
This approach is used by system utilities such as the Open common dialog box to disable AutoRun. Your application can respond to this message to suppress AutoRun. With systems that have Shell version 4.70 and later, Windows sends a 'Quer圜ancelAutoPlay' message to the foreground window. However, it is usually preferable to handle this operation programmatically rather than depending on the user. Users can manually suppress AutoRun by holding down the SHIFT key when they insert the CD-ROM. In either case, you will normally not want to launch another application while the original is in progress.
There are a variety of situations where AutoRun may need to be suppressed programmatically. The system provides several ways to disable AutoRun. For example, AutoRun might interfere with the operation of a running application and need to be disabled for the duration. There are many situations where AutoRun may need to be temporarily or persistently disabled.