VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "Demo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
' Simple MTS example
' Copyright © 1998 by Desaware Inc. All Rights Reserved

Option Explicit

Implements ObjectControl

Public MyClient As Object
Private objectnum As Long

Public Property Get MyID() As Long
   MyID = objectnum
End Property

Public Sub PerformOperation(ByVal objectnumber As Long, ByVal iscomplete As Boolean)
   Dim obj As ObjectContext
   objectnum = objectnumber
   MyClient.message "Operation Performed: " & objectnum
   Set obj = GetObjectContext()
   
   If iscomplete Then obj.SetComplete
End Sub

Private Sub Class_Terminate()
   If Not MyClient Is Nothing Then
      MyClient.message "Object terminating: " & objectnum
   End If
End Sub

Private Sub ObjectControl_Activate()
   If Not MyClient Is Nothing Then
      MyClient.message "Object activiated: " & objectnum
   End If
End Sub

Private Function ObjectControl_CanBePooled() As Boolean
   ObjectControl_CanBePooled = True
End Function

Private Sub ObjectControl_Deactivate()
   If Not MyClient Is Nothing Then
      MyClient.message "Object deactivated: " & objectnum
   End If
End Sub
