Name

SafeCallErrorProc Variable

Syntax

var SafeCallErrorProc: Pointer;

procedure SafeCallError(ErrorCode: Integer; ErrorAddr: Pointer);
begin ... end;
SafeCallErrorProc := @SafeCallError;

Description

Delphi calls the procedure that SafeCallErrorProc points to when a safecall routine returns an HResult that indicates an error. If SafeCallErrorProc is nil, or if the procedure does not raise an exception (so it returns normally), Delphi reports runtime error 24 (ESafeCallException).

Tips and Tricks

  • The ComObj unit sets this variable to a procedure that tries to get IErrorInfo information, and raise an EOleException exception using the ErrorCode and IErrorInfo data.

  • When you implement a COM server in Delphi, any Delphi exceptions raised in a safecall method are handled by the object’s SafeCallException method and mapped to an HResult. The SafeCallErrorProc procedure is called only for runtime errors and non-Delphi exceptions.

See Also

Function Keyword, Interface Keyword, Procedure Keyword, Safecall Directive, TObject Type
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset