Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy do commands invoked by shortcuts never crash in MFC under Windows 7
    primarykey
    data
    text
    <p>When a command is invoked via a keyboard shortcut in an MFC application under Windows 7, the application won't crash even if some illegal operation such as divison by zero or an access violation occurs during the execution of the command handler. How ever The same command invoked via the menu will crash as expected.</p> <p>This behaviour occurs under Windows 7 but not under Windows XP (I have no Vista to check). It doesn't matter if the application has been compiled with Visual Studio 6 or with Visual Studio 2010 and if MFC is linked statically or not and if it's the release or the debug build.</p> <p>This is obviously a major problem, because in case of an access violation or some other problem, the command stops prematurely, potentially leaving data in an undefined state and the application just continues as if nothing had happened. Every MFC application in the world is potentially concerned by this problem.</p> <p>The problem can be circumvented by implementing a special stub command handler for every keyboard shortcut. These stub commands then just put the WM_COMMAND back into the message via the PostMessage function. </p> <p>The complete Visual Studio 6 and 2010 projects of a very simple stub application that demonstrates the problem and the solution can be found here:</p> <p><a href="http://www.epsitec.ch/download/mfccrash/mfccrash.zip" rel="nofollow">http://www.epsitec.ch/download/mfccrash/mfccrash.zip</a></p> <p>So the the actuel question is: does anybody know what's going on ? And can anyone suggest a more elegant sulution that the one I have found ?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload