I have an Dialog-based MFC application that reads data from CDs. During program execution, the user can change CDs to research data from a different CD.
To avoid the "AutoRun" window when CDs are swapped out, I'm following the instructions for responding to the QueryCancelAutoPlay message as described here... http://msdn.microsoft.com/en-us/library/cc144204(VS.85).aspx
...except that I'm setting up a message handler with ON_REGISTERED_MESSAGE.
When I compile the application in Debug mode, the AutoPlay window is cancelled just like expected. But if I change my project to Release mode, the AutoPlay window still displays. I've tested this on at least two machines (both running Windows 7 - 64 bit). I've inserted an AfxMessageBox to the message handler to prove the problem seems to be in my top-level window getting the message (NOT a problem with the response to the message).
When I created this MFC Dialog Project, the only options I changed was to use MFC in a Static Library and Use Multi-Byte Character Set (as well as the typical changes for Include Directories, Additional Linker Dependencies, and Additional Library Directories).