IObjectContext::SetAbort, IObjectContext::SetComplete Methods Example

#include <mtx.h>


IObjectContext* pObjectContext = NULL;
HRESULT hr;

hr = GetObjectContext(&pObjectContext);
// Do some work here.
// If the work was successful, call SetComplete.
if (SUCCEEDED(hr)) {
    if (pObjectContext)
        pObjectContext->SetComplete();
}
// Otherwise, call SetAbort.
else {
    if (pObjectContext)
        pObjectContext->SetAbort();
}