RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.ExceptProc Variable

Points to the lowest-level exception handler.

Pascal
ExceptProc: Pointer;
C++
void * ExceptProc;

In Delphi code, ExceptProc handles unhandled exceptions (exceptions that have not been caught in the except portion of a try..except statement.) If your application has a TApplication object, it automatically catches exceptions and generates an OnException event (to which you can respond using either the application's or a TApplicationEvents object's OnException event handler). Thus, because the TApplication object catches the exceptions, they never reach the ExceptProc handler. However, even if you have a TApplication object, it does not catch exceptions generated during initialization and finalization. These are handled by ExceptProc. 

You can hook into ExceptProc to change how unhandled exceptions are reported. To do so, save the contexts of ExceptProc before changing it to the address of your own exception handler. The first statement of your new exception handler must then reinstall the saved value of ExceptProc. In this way, the ExceptProc procedure becomes part of a chain of exception procedures, each of which is executed in reverse order of installation. 

The procedure assigned to ExceptProc must have a signature such as the following: 

procedure ExceptHandler(ExceptObject: System::TObject; ExceptAddr: Pointer);

Note: :On Linux, ExceptProc may be called when most of the runtime has already shut down. This happens if an application terminates with an unhandled exception.
 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!