On Wed, 6 Feb 2008 10:01:42 -0800 (PST), PeteOlcott
<PeteOlc...@gmail.com>
wrote:
I am creating and invoking a DialogBox within the
PreTranslateMessage() hander of another DialogBox. If I comment out
the DoModal() invocation, the exception is not thrown. If I leave it
in, the Debug Assertion Failed! message appears. The ASSERT statement
is located within MS Windows void CWnd::AssertValid(). What is going
on here? What can I do to make it work correctly?
Doing complicated stuff like showing a secondary dialog inside
PreTranslateMessage is not the best practice in the world, but I see no
reason it shouldn't work. Your best course of action is probably to take
a
cue from the function name and translate the message into a WM_COMMAND of
your choosing, which you post to yourself and receive in an ordinary
command handler function. This may well not solve your problem, and in
case
it doesn't, and for future reference when dealing with assertions, here
are
the questions that come to mind.
What *exactly* does the assertion say? (They're usually at least somewhat
descriptive and come with filename and line number info - for others to
make sense of the latter, you need to state your compiler version.)