My wxApp derived class has an object that may throw an exception in its constructor, in which case I would want to post a message box to report the error and immediately close the program.
However, I don't know how to catch this exception. I'm using wxIMPLEMENT_APP to instantiate my wxApp object.... and OnExceptionInMainLoop and OnUnhandledException won't work because they depend on the wxApp object being fully constructed.
My current workaround is to allocate the object dynamically in OnInit and catch the exception there -- but is there another way?
Thanks.
Handling exceptions in wxApp constructor Topic is solved
- T-Rex
- Moderator
- Posts: 1199
- Joined: Sat Oct 23, 2004 9:58 am
- Location: Zaporizhzhya, Ukraine
- Contact:
Re: Handling exceptions in wxApp constructor
Looks like current workaround is the best way to do the initialization.
I assume that you can use wxIMPLEMENT_APP_NO_MAIN and then implement the main() function manually, but allocation in OnInit() still looks reasonable,
I assume that you can use wxIMPLEMENT_APP_NO_MAIN and then implement the main() function manually, but allocation in OnInit() still looks reasonable,
Re: Handling exceptions in wxApp constructor
Alright. That's what I figured, but I thought I'd check to be sure.
Thanks!
Thanks!