VERSION 5.00
Object = "{5DFD6B14-B084-47AF-9C0B-4FBF45649BCC}#1.0#0"; "FKAttend.ocx"
Begin VB.Form frmMain 
   BackColor       =   &H00C0FFC0&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Main Menu"
   ClientHeight    =   8055
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   8100
   FillColor       =   &H008080FF&
   Icon            =   "frmMain.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   537
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   540
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton cmdSystemInfo 
      Caption         =   "System Info Management"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   540
      Left            =   4345
      TabIndex        =   44
      Top             =   3948
      Width           =   3420
   End
   Begin VB.CommandButton cmdLogData 
      Caption         =   "Log Data Management"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   540
      Left            =   4340
      TabIndex        =   43
      Top             =   3292
      Width           =   3420
   End
   Begin VB.CommandButton cmdEnrollData 
      Caption         =   "Enroll Data Management"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   540
      Left            =   4335
      TabIndex        =   42
      Top             =   2636
      Width           =   3420
   End
   Begin VB.CommandButton cmdProuctData 
      Caption         =   "Get Product Data"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   540
      Left            =   4330
      TabIndex        =   41
      Top             =   4604
      Width           =   3420
   End
   Begin VB.CommandButton cmdBellInfo 
      Caption         =   "Bell Time"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   540
      Left            =   4325
      TabIndex        =   40
      Top             =   5260
      Width           =   3420
   End
   Begin VB.CommandButton cmdUserInfo 
      Caption         =   "Set UserInfo"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   540
      Left            =   4320
      TabIndex        =   39
      Top             =   5916
      Width           =   3420
   End
   Begin VB.CommandButton cmdOpenComm 
      Caption         =   "Open Comm"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   540
      Left            =   4320
      TabIndex        =   38
      Top             =   1980
      Width           =   1650
   End
   Begin VB.CommandButton cmdCloseComm 
      Caption         =   "Close Comm"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   540
      Left            =   6090
      TabIndex        =   37
      Top             =   1980
      Width           =   1650
   End
   Begin VB.CommandButton cmdSetPassTime 
      Caption         =   "Set PassTime"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   540
      Left            =   4350
      TabIndex        =   36
      Top             =   6572
      Width           =   3420
   End
   Begin VB.CommandButton cmdAdjustInfo 
      Caption         =   "Set Adjust Info"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   540
      Left            =   4350
      TabIndex        =   35
      Top             =   7230
      Width           =   3420
   End
   Begin FKAttendLib.FKAttend FKAttend 
      Height          =   480
      Left            =   2040
      TabIndex        =   34
      Top             =   765
      Width           =   480
      _Version        =   65536
      _ExtentX        =   847
      _ExtentY        =   847
      _StockProps     =   0
   End
   Begin VB.OptionButton optUSBDevice 
      BackColor       =   &H00C0FFC0&
      Caption         =   "USB Device"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   480
      TabIndex        =   24
      Top             =   2040
      Width           =   2220
   End
   Begin VB.TextBox txtLicense 
      Alignment       =   2  'Center
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Left            =   5760
      TabIndex        =   18
      Text            =   "0"
      Top             =   1380
      Width           =   840
   End
   Begin VB.TextBox txtMachineNumber 
      Alignment       =   2  'Center
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Left            =   3120
      TabIndex        =   13
      Text            =   "1"
      Top             =   1380
      Width           =   600
   End
   Begin VB.OptionButton optSerialDevice 
      BackColor       =   &H00C0FFC0&
      Caption         =   "Serial Device"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   480
      TabIndex        =   8
      Top             =   2325
      Width           =   2220
   End
   Begin VB.Frame Frame3 
      BackColor       =   &H00C0FFC0&
      Caption         =   "    "
      Height          =   2340
      Left            =   330
      TabIndex        =   9
      Top             =   2355
      Width           =   3900
      Begin VB.TextBox txtTelNumber 
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2880
         TabIndex        =   29
         Text            =   "806"
         Top             =   1320
         Width           =   915
      End
      Begin VB.TextBox txtWaitDialTime 
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2895
         TabIndex        =   26
         Text            =   "20"
         Top             =   1800
         Width           =   615
      End
      Begin VB.CheckBox chkUsingModem 
         BackColor       =   &H00C0FFC0&
         Caption         =   "Using Modem"
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   360
         Left            =   120
         TabIndex        =   25
         Top             =   1320
         Width           =   1830
      End
      Begin VB.ComboBox cmbCommBaudRate 
         BeginProperty DataFormat 
            Type            =   1
            Format          =   "0"
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   1
         EndProperty
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   405
         ItemData        =   "frmMain.frx":0442
         Left            =   1740
         List            =   "frmMain.frx":0455
         Style           =   2  'Dropdown List
         TabIndex        =   16
         Top             =   840
         Width           =   1575
      End
      Begin VB.ComboBox cmbComPort 
         BeginProperty DataFormat 
            Type            =   1
            Format          =   "0"
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   1
         EndProperty
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   405
         ItemData        =   "frmMain.frx":047C
         Left            =   1740
         List            =   "frmMain.frx":048C
         Style           =   2  'Dropdown List
         TabIndex        =   14
         Top             =   356
         Width           =   1575
      End
      Begin VB.Label lblTelphon 
         BackStyle       =   0  'Transparent
         Caption         =   "Tel No."
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   2100
         TabIndex        =   30
         Top             =   1365
         Width           =   840
      End
      Begin VB.Label lblWaitTime 
         BackStyle       =   0  'Transparent
         Caption         =   "Wait Time For Dialing"
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   780
         TabIndex        =   28
         Top             =   1800
         Width           =   2115
      End
      Begin VB.Label lblS 
         BackStyle       =   0  'Transparent
         Caption         =   "S"
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   3570
         TabIndex        =   27
         Top             =   1800
         Width           =   180
      End
      Begin VB.Label lblComBaudRate 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Baudrate : "
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   300
         TabIndex        =   17
         Top             =   900
         Width           =   1125
      End
      Begin VB.Label lblComPort 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "ComPort : "
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   300
         TabIndex        =   15
         Top             =   416
         Width           =   1200
      End
   End
   Begin VB.OptionButton optNetworkDevice 
      BackColor       =   &H00C0FFC0&
      Caption         =   "Network Device"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   480
      TabIndex        =   2
      Top             =   4740
      Width           =   2220
   End
   Begin VB.Frame Frame2 
      BackColor       =   &H00C0FFC0&
      Height          =   3000
      Left            =   330
      TabIndex        =   3
      Top             =   4770
      Width           =   3900
      Begin VB.CommandButton cmdGetDeviceIP 
         Caption         =   "..."
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   405
         Left            =   3045
         TabIndex        =   33
         Top             =   1275
         Width           =   600
      End
      Begin VB.TextBox txtDeviceName 
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   405
         Left            =   1800
         TabIndex        =   31
         Text            =   "FingerKeeper"
         Top             =   840
         Width           =   1845
      End
      Begin VB.CheckBox chkUDPFlag 
         BackColor       =   &H00C0FFC0&
         Caption         =   "UDP"
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1800
         TabIndex        =   22
         Top             =   2610
         Width           =   975
      End
      Begin VB.TextBox txtTimeOut 
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   405
         Left            =   1800
         TabIndex        =   20
         Text            =   "5000"
         Top             =   2190
         Width           =   855
      End
      Begin VB.TextBox txtPassword 
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   405
         Left            =   1800
         TabIndex        =   12
         Text            =   "0"
         Top             =   1740
         Width           =   855
      End
      Begin VB.TextBox txtPortNo 
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   405
         Left            =   1800
         TabIndex        =   5
         Text            =   "5005"
         Top             =   1290
         Width           =   855
      End
      Begin VB.TextBox txtIPAddress 
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   405
         Left            =   1800
         TabIndex        =   4
         Text            =   "192.168.0.9"
         Top             =   400
         Width           =   1830
      End
      Begin VB.Label lblDeviceName 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Device Name:"
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   150
         TabIndex        =   32
         Top             =   900
         Width           =   1440
      End
      Begin VB.Label lblTimeOutT 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "(ms)"
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   2760
         TabIndex        =   23
         Top             =   2235
         Width           =   555
      End
      Begin VB.Label lblTimeOut 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "TimeOut :"
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   150
         TabIndex        =   21
         Top             =   2250
         Width           =   1650
      End
      Begin VB.Label lblPassword 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Password :"
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   150
         TabIndex        =   11
         Top             =   1800
         Width           =   1650
      End
      Begin VB.Label lblPortNo 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Port Number :"
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   150
         TabIndex        =   7
         Top             =   1350
         Width           =   1650
      End
      Begin VB.Label lblIPAddress 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "IP Address :"
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   150
         TabIndex        =   6
         Top             =   460
         Width           =   1650
      End
   End
   Begin VB.Label lblComLicense 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "License :"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   4800
      TabIndex        =   19
      Top             =   1440
      Width           =   810
   End
   Begin VB.Label lblMachineNumber 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Machine Number :"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   1320
      TabIndex        =   10
      Top             =   1440
      Width           =   1710
   End
   Begin VB.Label lblVer 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "FKAttend.ocx (Ver 2.52)"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   14.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   330
      Left            =   0
      TabIndex        =   1
      Top             =   810
      Width           =   8040
   End
   Begin VB.Label lbSubject 
      Alignment       =   2  'Center
      BackColor       =   &H80000013&
      BackStyle       =   0  'Transparent
      Caption         =   "FingerKeeper Sample"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   20.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   480
      Left            =   0
      TabIndex        =   0
      Top             =   180
      Width           =   8040
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public gbOpenFlag As Boolean

Private Sub cmdAdjustInfo_Click()
    Me.Visible = False
    frmAdjust.Visible = True
End Sub

Private Sub cmdGetDeviceIP_Click()
    Dim m_DeviceName As String
    Dim strlen As Long
    m_DeviceName = txtDeviceName.Text
    strlen = Len(m_DeviceName)
    Trim (m_DeviceName)
    FKAttend.ConnectGetIP m_DeviceName
    txtIPAddress.Text = m_DeviceName
End Sub

Private Sub Form_Load()
    optSerialDevice.Value = False
    optNetworkDevice.Value = True
    optUSBDevice.Value = False
    OwnerEnableButtons False
    
    gbOpenFlag = False
    txtMachineNumber.Text = "1"
    cmbComPort.ListIndex = 0
    cmbCommBaudRate.ListIndex = 2
End Sub

Private Sub Form_Unload(Cancel As Integer)
    cmdCloseComm_Click
End Sub

Private Sub chkUsingModem_Click()
    optSerialDevice_Click
End Sub

Private Sub optSerialDevice_Click()
    If optSerialDevice.Value = True Then
        OwnerEnableItems 1
    End If
End Sub

Private Sub optNetworkDevice_Click()
    If optNetworkDevice.Value = True Then
        OwnerEnableItems 2
    End If
End Sub

Private Sub optUSBDevice_Click()
    If optUSBDevice.Value = True Then
        OwnerEnableItems 3
    End If
End Sub

Private Sub cmdOpenComm_Click()
    Dim vnMachineNumber As Long
    Dim vnCommPort As Long
    Dim vnCommBaudrate As Long
    Dim vstrTelNumber As String
    Dim vnWaitDialTime As Long
    Dim vnLicense As Long
    Dim vpszIPAddress As String
    Dim vpszNetPort As Long
    Dim vpszNetPassword As Long
    Dim vnTimeOut As Long
    Dim vnProtocolType As Long
    Dim vnResultCode As Long
    
    cmdOpenComm.Enabled = False
    vnMachineNumber = Val(txtMachineNumber.Text)
    vnLicense = Val(txtLicense.Text)
    If optSerialDevice.Value = True Then

        If chkUsingModem.Value = vbChecked Then
            vstrTelNumber = Trim(txtTelNumber.Text)
            vnWaitDialTime = Val(Trim(txtWaitDialTime.Text))
            If vnWaitDialTime < 10 And vnWaitDialTime > 60 Then
                vnWaitDialTime = 10
                txtWaitDialTime.Text = "10"
            End If
        Else
            vstrTelNumber = ""
            vnWaitDialTime = 0
        End If

        vnCommPort = Val(Trim(cmbComPort.Text))
        vnCommBaudrate = Val(Trim(cmbCommBaudRate.Text))
        vnResultCode = FKAttend.ConnectComm(vnMachineNumber, vnCommPort, vnCommBaudrate, vstrTelNumber, vnWaitDialTime, vnLicense)
    ElseIf optNetworkDevice.Value = True Then
        vpszIPAddress = Trim(txtIPAddress.Text)
        vpszNetPort = CLng(txtPortNo.Text)
        vpszNetPassword = CLng(txtPassword.Text)
        vnTimeOut = CLng(txtTimeOut.Text)
        If chkUDPFlag.Value = vbUnchecked Then
            vnProtocolType = PROTOCOL_TCPIP
        Else
            vnProtocolType = PROTOCOL_UDP
        End If
        vnResultCode = FKAttend.ConnectNet(vnMachineNumber, vpszIPAddress, vpszNetPort, vnTimeOut, vnProtocolType, vpszNetPassword, vnLicense)
    ElseIf optUSBDevice.Value = True Then
        vnResultCode = FKAttend.ConnectUSB(vnMachineNumber, vnLicense)
    End If
    
    If vnResultCode = RUN_SUCCESS Then
        gbOpenFlag = True
        OwnerEnableButtons True
    Else
        MsgBox ReturnResultPrint(vnResultCode), vbOKOnly, "error"
        cmdOpenComm.Enabled = True
    End If
End Sub

Private Sub cmdCloseComm_Click()
    If gbOpenFlag = True Then
        FKAttend.Disconnect
        gbOpenFlag = False
        OwnerEnableButtons False
    End If
End Sub

Private Sub cmdEnrollData_Click()
    Me.Visible = False
    frmEnroll.Visible = True
End Sub

Private Sub cmdLogData_Click()
    Me.Visible = False
    frmLog.Visible = True
End Sub

Private Sub cmdSystemInfo_Click()
    Me.Visible = False
    frmSystemInfo.Visible = True
End Sub

Private Sub cmdProuctData_Click()
    Me.Visible = False
    frmProductData.Visible = True
End Sub

Private Sub cmdBellInfo_Click()
    Me.Visible = False
    frmBellInfo.Visible = True
End Sub

Private Sub cmdUserInfo_Click()
    Me.Visible = False
    frmUserInfo.Visible = True
End Sub

Private Sub cmdSetPassTime_Click()
    Me.Visible = False
    frmPassTimeInfo.Visible = True
End Sub

Private Sub OwnerEnableButtons(abEnableFlag As Boolean)
    cmdOpenComm.Enabled = Not abEnableFlag
    cmdCloseComm.Enabled = abEnableFlag
    cmdSystemInfo.Enabled = abEnableFlag
    cmdProuctData.Enabled = abEnableFlag
    cmdBellInfo.Enabled = abEnableFlag
    cmdUserInfo.Enabled = abEnableFlag
    cmdSetPassTime.Enabled = abEnableFlag
    cmdAdjustInfo.Enabled = abEnableFlag
    
    optSerialDevice.Enabled = Not abEnableFlag
    optNetworkDevice.Enabled = Not abEnableFlag
    optUSBDevice.Enabled = Not abEnableFlag
End Sub

Private Sub OwnerEnableItems(anEnableFlag As Long)
    lblComPort.Enabled = False
    cmbComPort.Enabled = False
    lblComBaudRate.Enabled = False
    cmbCommBaudRate.Enabled = False
    chkUsingModem.Enabled = False
    lblTelphon.Enabled = False
    txtTelNumber.Enabled = False
    lblWaitTime.Enabled = False
    txtWaitDialTime.Enabled = False
    lblS.Enabled = False

    lblIPAddress.Enabled = False
    txtIPAddress.Enabled = False
    lblDeviceName.Enabled = False
    txtDeviceName.Enabled = False
    lblPortNo.Enabled = False
    txtPortNo.Enabled = False
    lblPassword.Enabled = False
    txtPassword.Enabled = False
    lblTimeOut.Enabled = False
    txtTimeOut.Enabled = False
    lblTimeOutT.Enabled = False
    chkUDPFlag.Enabled = False
    
    Select Case anEnableFlag
        Case 1
            lblComPort.Enabled = True
            cmbComPort.Enabled = True
            lblComBaudRate.Enabled = True
            cmbCommBaudRate.Enabled = True
            chkUsingModem.Enabled = True
            If chkUsingModem.Value = vbChecked Then
                lblTelphon.Enabled = True
                txtTelNumber.Enabled = True
                lblWaitTime.Enabled = True
                txtWaitDialTime.Enabled = True
                lblS.Enabled = True
            End If
            
        Case 2
            lblIPAddress.Enabled = True
            txtIPAddress.Enabled = True
            lblDeviceName.Enabled = True
            txtDeviceName.Enabled = True
            lblPortNo.Enabled = True
            txtPortNo.Enabled = True
            lblPassword.Enabled = True
            txtPassword.Enabled = True
            lblTimeOut.Enabled = True
            txtTimeOut.Enabled = True
            lblTimeOutT.Enabled = True
            chkUDPFlag.Enabled = True
    End Select
End Sub

