Author: Bruce VarleyBruce Varley
Date: Apr 14, 2008 06:24
> Hi, My MFC application is bombproof in Debug, but crashes in release. The
> Windows error message states that a specified memory location could not be
> read.
>
> In release the program starts up OK and does quite a lot. The crash occurs
> when a key is pressed, ie. the first keyboard message is sent (WM_CHAR).
> Any suggestions on an area to look in? TIA
I managed to shrink the problem back to essentially an MFC Hello world, with
only a null keyboard handler to manifest the problem. Then, purely as a
guess, I removed one of the arguments from the handler, ie. changed the
prototype to ...(UINT, UINT), and the problem went away. I'm confused, all
the documentation I have on CDC::OnChar, the prototype is at the end. But
that standard form causes a crash.
It seems that these internal handler functions aren't type checked by the
compiler, I was able to set the args so that hte application was obviously
beset with a major problem (which was difficult to find) and there were no
errors reported. Is there some technique or settings that enable this sort
of nasty problem to be flagged? Or is this just something that the MFC
structure can't see?
|