Platform SDK: Transaction Server

createObject Method

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

Instantiates an MTS object.

Provided By

Context class

IUnknown createObject (String progID);
IUnknown createObject (com.ms.com._Guid rclsid)

Parameters

progID
[in] The programmatic identifier (ProgID) of the object to be created.

rclsid
[in] Reference to the class identifier (CLSID) of the object to be created.

Return Value

A reference to the IUnknown interface on the newly created object.

Remarks

createObject creates a COM object. However, the object will have context only if its component is registered with MTS.

When you create an object by using createObject, the new object's context is derived from the current object's Context and the declarative properties of the new object's component. The new object always executes within the same activity as the object that created it. If the current object has a transaction, the transaction attribute of the new object's component determines whether or not the new object will execute within the scope of that transaction.

If the component's transaction attribute is set to either Requires a transaction or Supports transactions, the new object inherits its creator's transaction. If the component's transaction attribute is set to Requires a new transaction, MTS initiates a new transaction for the new object. If the component's transaction attribute is set to Does not support transactions, the new object doesn't execute under any transaction.

MTS always uses standard marshaling. Even if a component exposes the IMarshal interface, its IMarshal methods will never be called by the MTS run-time environment.

You can't create MTS objects as part of an aggregation.

See Also

Creating MTS Objects, Transaction Attributes, MTS Component Requirements