Link to home
Start Free TrialLog in
Avatar of oxygen_728
oxygen_728

asked on

MFC Exception Handling - What happens to an uncaught exception thrown in an event-handler?

If an event handler throws an exception, and it is not caught by a programmer-defined try/catch block, is the event canceled?

In all cases, only in some?

Thanks
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

I think an unhandled exception will always result in the program crashing, not the event being canceled.
Avatar of sjith2000
sjith2000

If the unhandled exception occurs in the event handler, the application crashes and the message won't be removed from the message queue.
sjith2000 - please read the comments by other experts first.
Hi AndyAinscow,
  I am very glad to say that I had already seen the comment written by you.I also feel that the application will crash as you think.Also I feel that the message won't be removed from the message queue
Avatar of oxygen_728

ASKER

Thanks for the comments thus far,

I have had my suspicions that the application would crash.

I hope to test it soon.

Thanks for the input
To duplicate a previous experts comment with referring to it is not polite (or useful) behaviour.
If you agree with a comment posted earler then why not say so.
eg.
Andy is correct, the app will crash.
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>>> I feel that the message won't be removed from the message queue
an exception is independent of the existence or non-existance of message queues. Exeption handling is realized by some kind of 'long jumps' along the call stack.

>>>> have had my suspicions that the application would crash.
What is the reason for your doubts. As Andy showed, it is simple to verify that unhandled exceptions lead to a crash.

Regards, Alex