CoLeaveServiceDomain function (comsvcs.h)
Used to leave code that uses COM+ services.
Syntax
void CoLeaveServiceDomain(
[in] IUnknown *pUnkStatus
);
Parameters
[in] pUnkStatus
If you want to know the status of the transaction that is completed by the call, this must be a pointer to the IUnknown interface of an object that implements the ITransactionStatus interface. If the enclosed code did not use transactions or if you do not need to know the transaction status, this parameter should be NULL. This parameter is ignored if it is non-NULL and if no transactions were used in the service domain.
Return value
None
Remarks
Code that is enclosed between calls to CoEnterServiceDomain and CoLeaveServiceDomain runs in its own context and behaves as though it were a method that is called from an object created within the context.
CoLeaveServiceDomain triggers the server and then the client side policies as if a method call was returning. The current context is then popped from the context stack, and the context that was running when CoEnterServiceDomain was called becomes the current context.
Because of their efficient design and because no thread marshaling is involved, using CoEnterServiceDomain and CoLeaveServiceDomain involves significantly reduced overhead as compared to an equivalent method call.
CoEnterServiceDomain and CoLeaveServiceDomain are particularly useful in applications, which can use these functions to access COM+ services without needing to create a component to do so.
The CoEnterServiceDomain and CoLeaveServiceDomain pairs can be nested. It is up to the user to make sure that the pairs of calls are balanced so that every call to CoLeaveServiceDomain matches a previous call to CoEnterServiceDomain.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | comsvcs.h |
Library | ComSvcs.lib |
DLL | ComSvcs.dll |