Platform SDK: Transaction Server

ITransactionContextEx::CreateInstance Method Example

[This product will work only on Windows NT 4.0 versions and earlier. For Windows 2000 and later, see COM+ (Component Services).]

#include <Txctx.h>

ITransactionContextEx* pTransactionContext = NULL;
IMyObject* pMyObject = NULL;
HRESULT hr;

// Get TransactionContextEx.
hr = CoCreateInstance(CLSID_ITransactionContextEx, 
    NULL, CLSCTX_INPROC, IID_ITransactionContextEx, 
    (void**) &pTransactionContext);

// Create an instance of MyObject.
hr = pTransactionContext->CreateInstance 
    (CLSID_CMyObject, IID_IMyObject,
    (void**) &pMyObject);