Name
ExceptObjProc Variable
Syntax
var ExceptObjProc: Pointer; functionExceptProc
(var Rec: TExceptionRecord): TObject; begin ... end; ... ExceptObjProc := @ExceptProc
;
Description
When a Windows exception occurs, Delphi calls the procedure
ExceptObjProc
points to (if the variable is not
nil
). The ExceptObjProc
function returns a new exception object that corresponds to the
Windows exception. If ExceptObjProc
is
nil
or if it returns nil
,
Delphi lets the Windows exception terminate the application.
The sole argument to the ExceptObjProc
function is
a pointer to an exception record.
Tips and Tricks
The
Windows
unit defines theTExceptionRecord
type. See the Windows Platform SDK documentation to learn about this record.The
SysUtils
unit setsExceptObjProc
to a function that maps all the Windows exceptions to appropriate Delphi exceptions, e.g.,Status_Integer_Overflow
becomes anEIntOverflow
object.
Example
// Call the ExceptClsProc procedure to get the exception class,
// then create and return the exception object.
function CustomExceptObjFunc(var Rec: TExceptionRecord): TObject;
begin
Result := CustomExceptClsFunc(Rec).Create;
end;
ExceptObjProc := @CustomExceptObjFunc;
See Also
ExceptClsProc Variable, ExceptProc Variable, TExceptionRecord Type |
Get Delphi in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.