ObjectContext::SetAbort method (comsvcs.h)
Declares that the transaction in which the object is executing must be aborted and that the object should be deactivated on return.
Syntax
HRESULT SetAbort();
Return value
This method can return the standard return values E_INVALIDARG, E_OUTOFMEMORY, and E_FAIL, as well as the following values.
Return code | Description |
---|---|
|
The method completed successfully. |
|
An unexpected error has occurred. This can happen if one object passes its ObjectContext pointer to another object and the other object calls SetAbort using this pointer. An ObjectContext pointer is not valid outside the context of the object that originally obtained it. |
Remarks
The object is deactivated automatically on return from the method in which it called SetAbort. If the object is the root of an automatic transaction, COM+ aborts the transaction. If the object is transactional but not the root of an automatic transaction, the transaction in which it is participating is doomed to abort.
You can call SetAbort in error handlers to ensure that a transaction aborts when an error occurs. You can also call SetAbort at the beginning of a method to prevent your object from committing prematurely in the event of an unexpected return and then, if all goes well, call SetComplete just before the method returns.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | comsvcs.h |