Summary

[Previous] [Next]

This chapter covered crash handlers, which are exception handlers and unhandled exception filters. Both allow you to get more information about a crash and provide a better face to the user when your application does have problems. Whereas unhandled exception filters work in both Visual C++ and Visual Basic code, exception handling works only with Visual C++.

C++ exceptions and SEH exceptions are sometimes confused. The C++ language specification provides C++ exceptions, whereas the operating system provides SEH; the two kinds of exception handling are completely different. Fortunately, you can combine C++ exceptions and SEH with the run-time library function _set_se_translator.

One key point you need to make sure that you understand is the differences between asynchronous and synchronous C++ exception handling. The easiest way to keep the differences between these two types of C++ exception handling straight is to think of asynchronous as "all functions track lifetimes of objects" and synchronous as "some functions track lifetimes of objects."

The magic function that does the work to make crash handlers possible is SetUnhandledExceptionFilter, which allows you to set the final SEH exception filter. The final exception filter allows you to gain control right before the Application Error dialog box pops up so that you can record all sorts of great information about why you crashed. The CrashHandler code presented will make it easier to set unhandled exception filters and will do the hard work of translating the crash information for you so that you can concentrate on the display and the unique parts of your application.



Debugging Applications
Debugging Applications for MicrosoftВ® .NET and Microsoft WindowsВ® (Pro-Developer)
ISBN: 0735615365
EAN: 2147483647
Year: 2000
Pages: 122
Authors: John Robbins

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net