' A method in ComponentA (Obj1)
' Assume ComponentB exists in the same DLL
Public Sub CreateSecondaryObjects()
' the correct way to instantiate a MTS component
Dim ObjCtx As ObjectContext
Set ObjCtx = GetObjectContext()
Dim Obj2 As ComponentB
Set Obj2 = ObjCtx.CreateInstance("MyDLL.ComponentB")
' incorrect - introduces a proxy-stub layer
Dim Obj3 As ComponentB
Set Obj3 = CreateObject("MyDLL.ComponentB")
' incorrect - MTS interception scheme isn't set up properly
Dim Obj4 As ComponentB
Set Obj4 = New ComponentB
End Sub
Figure 3 Instantiating an MTS Component from another MTS Component