VERSION 5.00
Begin VB.Form frmMessage 
   Caption         =   "Message"
   ClientHeight    =   3030
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5205
   LinkTopic       =   "Form1"
   ScaleHeight     =   3030
   ScaleWidth      =   5205
   StartUpPosition =   3  'Windows ‚ÌŠù’è’l
   Begin VB.Frame Frame1 
      Caption         =   "Result"
      Height          =   975
      Left            =   120
      TabIndex        =   6
      Top             =   1440
      Width           =   4935
      Begin VB.TextBox txtResult 
         Height          =   270
         Left            =   1200
         TabIndex        =   10
         Text            =   "txtResult"
         Top             =   600
         Width           =   2415
      End
      Begin VB.Label txtResultTime 
         Caption         =   "txtResultTime"
         Height          =   255
         Left            =   1200
         TabIndex        =   8
         Top             =   240
         Width           =   2415
      End
      Begin VB.Label lblDateTime 
         Caption         =   "ResultTime :"
         Height          =   255
         Left            =   120
         TabIndex        =   7
         Top             =   240
         Width           =   975
      End
      Begin VB.Label lblResult 
         Caption         =   "Result :"
         Height          =   255
         Left            =   120
         TabIndex        =   9
         Top             =   600
         Width           =   615
      End
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "&Exit"
      Height          =   375
      Left            =   3840
      TabIndex        =   11
      Top             =   2520
      Width           =   1215
   End
   Begin VB.Frame frmExecute 
      Caption         =   "Execute"
      Height          =   1215
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   4935
      Begin VB.TextBox txtParam 
         Height          =   270
         Left            =   1200
         TabIndex        =   4
         Text            =   "txtParam"
         Top             =   720
         Width           =   2415
      End
      Begin VB.CommandButton cmdExecute 
         Caption         =   "&Execute"
         Height          =   375
         Left            =   3720
         TabIndex        =   5
         Top             =   360
         Width           =   1095
      End
      Begin VB.TextBox txtCmd 
         BeginProperty DataFormat 
            Type            =   1
            Format          =   "0"
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1041
            SubFormatType   =   1
         EndProperty
         Height          =   270
         Left            =   1200
         TabIndex        =   2
         Text            =   "txtMode"
         Top             =   360
         Width           =   2415
      End
      Begin VB.Label lblParam 
         Caption         =   "Parameter :"
         Height          =   255
         Left            =   120
         TabIndex        =   3
         Top             =   720
         Width           =   975
      End
      Begin VB.Label lblCommand 
         Caption         =   "Command :"
         Height          =   255
         Left            =   120
         TabIndex        =   1
         Top             =   360
         Width           =   975
      End
   End
End
Attribute VB_Name = "frmMessage"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private caoEng As CaoEngine
Private WithEvents caoCtrl As CaoController
Attribute caoCtrl.VB_VarHelpID = -1


Private Sub Form_Load()
    Set caoEng = New CaoEngine
    Set caoCtrl = caoEng.Workspaces(0).AddController("RC1", "CaoProv.Dummy")

    txtCmd = ""
    txtParam = ""
    txtResult = ""
    txtResultTime = ""
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set caoCtrl = Nothing
    Set caoEng = Nothing

End Sub

Private Sub cmdExecute_Click()
    
    caoCtrl.Execute txtCmd.Text, txtParam.Text
End Sub

Private Sub cmdExit_Click()
    Unload Me
End Sub

Private Sub caoCtrl_OnMessage(ByVal pICaoMess As CAOLib.ICaoMessage)
    Dim vntValue As Variant
    
    vntValue = pICaoMess.Value
    txtResultTime = pICaoMess.DateTime
    
    If IsEmpty(vntValue) Then
        txtResult = "(EMPTY)"
    Else
        txtResult = vntValue
    End If
End Sub
