VERSION 5.00
Begin VB.Form frmMonitor 
   Caption         =   "Blackboard Monitor"
   ClientHeight    =   3480
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4425
   LinkTopic       =   "Form1"
   ScaleHeight     =   3480
   ScaleWidth      =   4425
   StartUpPosition =   3  'Windows ‚ÌŠù’è’l
   Begin VB.ListBox List1 
      Height          =   1860
      Left            =   240
      TabIndex        =   2
      Top             =   1380
      Width           =   3915
   End
   Begin VB.CommandButton cmdConnect 
      Caption         =   "CONNECT"
      Height          =   495
      Left            =   3000
      TabIndex        =   1
      Top             =   420
      Width           =   1215
   End
   Begin VB.TextBox txtBB 
      Height          =   315
      Left            =   240
      TabIndex        =   0
      Text            =   "bb"
      Top             =   540
      Width           =   2595
   End
   Begin VB.Label Label1 
      Caption         =   "Event log : "
      Height          =   255
      Index           =   1
      Left            =   240
      TabIndex        =   4
      Top             =   1080
      Width           =   2535
   End
   Begin VB.Label Label1 
      Caption         =   "Blackboard (controller name) : "
      Height          =   255
      Index           =   0
      Left            =   240
      TabIndex        =   3
      Top             =   240
      Width           =   2535
   End
End
Attribute VB_Name = "frmMonitor"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'
' A Simple Blackboard Monitor
'
Dim caoEng As CaoEngine
Dim caoWs As CaoWorkspace
Dim WithEvents caoCtrl As CaoController
Attribute caoCtrl.VB_VarHelpID = -1

' Initialize
Private Sub Form_Load()

    Set caoEng = New CaoEngine
    Set caoWs = caoEng.Workspaces(0)

End Sub

' Create a blackboard
Private Sub cmdConnect_Click()
    
    Set caoCtrl = caoWs.AddController(txtBB.Text, "CaoProv.Blackboard")
 
End Sub

' Event sink
Private Sub caoCtrl_OnMessage(ByVal pICaoMess As CAOLib.ICaoMessage)

    On Error GoTo errSkip

    With pICaoMess
        List1.AddItem .Description & " : msgid=" & .Number & ", name=" & .Destination & ", value=" & .Value
    End With

    Exit Sub
errSkip:
    List1.AddItem Err.Description

End Sub

