VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "CallerID Monitor 2013 ActiveX Sample Code"
   ClientHeight    =   5364
   ClientLeft      =   108
   ClientTop       =   432
   ClientWidth     =   7320
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   ScaleHeight     =   5364
   ScaleWidth      =   7320
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command9 
      Caption         =   "Clear List"
      Height          =   420
      Left            =   3144
      TabIndex        =   9
      Top             =   4500
      Width           =   3696
   End
   Begin VB.CommandButton Command8 
      Caption         =   "Disable CallerID"
      Height          =   504
      Left            =   444
      TabIndex        =   8
      Top             =   4476
      Width           =   2400
   End
   Begin VB.CommandButton Command7 
      Caption         =   "Enable CallerID"
      Height          =   504
      Left            =   444
      TabIndex        =   7
      Top             =   1476
      Width           =   2400
   End
   Begin VB.CommandButton Command6 
      Caption         =   "Select Device  1"
      Height          =   504
      Left            =   444
      TabIndex        =   6
      Top             =   888
      Width           =   2400
   End
   Begin VB.CommandButton Command5 
      Caption         =   "Show Total Device"
      Height          =   504
      Left            =   444
      TabIndex        =   5
      Top             =   300
      Width           =   2400
   End
   Begin VB.CommandButton Command4 
      Caption         =   "Show Port Number"
      Height          =   504
      Left            =   444
      TabIndex        =   4
      Top             =   3840
      Width           =   2400
   End
   Begin VB.CommandButton Command3 
      Caption         =   "ShowOnlyNumber = True"
      Height          =   504
      Left            =   444
      TabIndex        =   3
      Top             =   2640
      Width           =   2400
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Show_Line_Number = False"
      Height          =   504
      Left            =   444
      TabIndex        =   2
      Top             =   2076
      Width           =   2400
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Show Last Status"
      Height          =   504
      Left            =   444
      TabIndex        =   1
      Top             =   3204
      Width           =   2400
   End
   Begin VB.Timer Timer_ReadBuffer 
      Enabled         =   0   'False
      Interval        =   500
      Left            =   60
      Top             =   60
   End
   Begin VB.ListBox List1 
      BackColor       =   &H00008000&
      ForeColor       =   &H0000FFFF&
      Height          =   4080
      ItemData        =   "Form1.frx":0000
      Left            =   3096
      List            =   "Form1.frx":0002
      TabIndex        =   0
      Top             =   348
      Width           =   3756
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim FirstRun As Boolean
Dim s As String
Dim CID As CallerID_ActiveX_class

Private Sub Command1_Click()
List1.AddItem CID.Last_Status
End Sub

Private Sub Command2_Click()
CID.Show_Line_Number (False)
End Sub

Private Sub Command3_Click()
CID.ShowOnlyNumber (True)
End Sub

Private Sub Command4_Click()
List1.AddItem CID.port_number
End Sub

Private Sub Command5_Click()
List1.AddItem CID.Total_Devices
End Sub

Private Sub Command6_Click()
CID.Select_Device (1)
End Sub

Private Sub Command7_Click()
CID.Enable_CallerID
Timer_ReadBuffer.Enabled = True
End Sub

Private Sub Command8_Click()
CID.Disable_CallerID
End Sub

Private Sub Command9_Click()
List1.Clear
End Sub

Private Sub Form_Activate()
If FirstRun = True Then
    Set CID = New CallerID_ActiveX_class
    FirstRun = False
End If
End Sub

Private Sub Form_Load()
FirstRun = True
End Sub

Private Sub Form_Unload(Cancel As Integer)
CID.Disable_CallerID
Set CID = Nothing
End Sub


Private Sub Timer_ReadBuffer_Timer()
s = CID.Read_Buffer
If s <> "" Then List1.AddItem s
End Sub
