RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TComObject.SafeCallException Method

Handles OLE exceptions.

Pascal
function SafeCallException(ExceptObject: TObject; ExceptAddr: Pointer): HResult; override;
C++
virtual __fastcall HRESULT SafeCallException(TObject * ExceptObject, void * ExceptAddr);

SafeCallException prevents an exception from being raised to escape its scope. Any exceptions raised must also be handled within the method. 

The implementation of a safecall method guarantees that no exceptions are raised by enclosing the statement part of the method in an implied exception block.

Note: SafeCallException calls the global routine HandleSafeCallException, which provides a standard way of handling this behavior. Methods of a CoClass that supports OLE exception handling (that implements the ISupportErrorInfo interface) are affected by this function. If those CoClass methods use the safecall calling convention, they are modified to return an HRESULT. Procedures will return an HRESULT, and functions will pass their usual result value as the last (out) parameter, and will return an HRESULT instead. The method is enclosed in a exception block, after which the HRESULT is returned, and the environment is set up so that the ISupportErrorInfo implementation will work correctly.
 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!