Suppressing AutoPlay

You can manually prevent the Autorun.inf file on a compact disc from being parsed and carried out by holding down the SHIFT key when you insert the disc. For users of Windows NT version 4.0 and Windows 95 with Internet Explorer version 4.0, however, you can suppress AutoPlay automatically. You might want to do this if your application has a setup application that requires the user to insert a disc that contains an Autorun.inf file. In this case, you do not want the AutoPlay feature to begin running an application while your setup application is running. To suppress AutoPlay if your setup application is in the foreground window, add the following code to your setup initialization code:

uMessage - RegisterWindowMessage(TEXT("QueryCancelAutoPlay"));

Then, add the following code to your setup window procedure:

if(msg == uMessage)

{

// return 1 to cancel AutoPlay

// return 0 to allow AutoPlay

return 1L;

}