VERSION 5.00
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Begin VB.Form winMain 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "WTScaleAdmin - Weigh-Tronix Scale OPOS/SO Administrator"
   ClientHeight    =   8625
   ClientLeft      =   45
   ClientTop       =   150
   ClientWidth     =   12315
   Icon            =   "Main.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   8625
   ScaleWidth      =   12315
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Tag             =   "0"
   Begin TabDlg.SSTab SSTab1 
      Height          =   8520
      Left            =   0
      TabIndex        =   0
      Top             =   120
      Width           =   12315
      _ExtentX        =   21722
      _ExtentY        =   15028
      _Version        =   393216
      Tabs            =   5
      Tab             =   2
      TabsPerRow      =   5
      TabHeight       =   520
      BackColor       =   12632256
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      TabCaption(0)   =   "Scale Profile"
      TabPicture(0)   =   "Main.frx":0442
      Tab(0).ControlEnabled=   0   'False
      Tab(0).Control(0)=   "frmScaleInstance"
      Tab(0).Control(1)=   "frmSerialCommunications"
      Tab(0).Control(2)=   "frmLogging"
      Tab(0).Control(3)=   "frmDetails"
      Tab(0).ControlCount=   4
      TabCaption(1)   =   "Scale Test"
      TabPicture(1)   =   "Main.frx":045E
      Tab(1).ControlEnabled=   0   'False
      Tab(1).Control(0)=   "Frame8"
      Tab(1).Control(1)=   "frmTest"
      Tab(1).Control(2)=   "MSComm1"
      Tab(1).Control(3)=   "timCommTimeout"
      Tab(1).ControlCount=   4
      TabCaption(2)   =   "Common"
      TabPicture(2)   =   "Main.frx":047A
      Tab(2).ControlEnabled=   -1  'True
      Tab(2).Control(0)=   "frmCommonProperties"
      Tab(2).Control(0).Enabled=   0   'False
      Tab(2).Control(1)=   "frmCommonMethods"
      Tab(2).Control(1).Enabled=   0   'False
      Tab(2).Control(2)=   "frmControlObject"
      Tab(2).Control(2).Enabled=   0   'False
      Tab(2).Control(3)=   "sbrStatus(0)"
      Tab(2).Control(3).Enabled=   0   'False
      Tab(2).ControlCount=   4
      TabCaption(3)   =   "Specific"
      TabPicture(3)   =   "Main.frx":0496
      Tab(3).ControlEnabled=   0   'False
      Tab(3).Control(0)=   "sbrStatus(1)"
      Tab(3).Control(0).Enabled=   0   'False
      Tab(3).Control(1)=   "frmScaleMethods"
      Tab(3).Control(1).Enabled=   0   'False
      Tab(3).Control(2)=   "frmScaleProperties"
      Tab(3).Control(2).Enabled=   0   'False
      Tab(3).ControlCount=   3
      TabCaption(4)   =   "Advanced"
      TabPicture(4)   =   "Main.frx":04B2
      Tab(4).ControlEnabled=   0   'False
      Tab(4).Control(0)=   "sbrStatus(3)"
      Tab(4).Control(1)=   "sbrStatus(2)"
      Tab(4).Control(2)=   "frmDirectIO"
      Tab(4).Control(3)=   "frmInitialScaleAttributes"
      Tab(4).Control(4)=   "frmVendorCmds"
      Tab(4).ControlCount=   5
      Begin VB.Frame frmVendorCmds 
         Caption         =   "Vendor (WT) Specific Commands:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   2535
         Left            =   -74640
         TabIndex        =   157
         Top             =   4320
         Width           =   11655
         Begin VB.CommandButton cmdGetTransaction 
            Caption         =   "Get Transaction"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   480
            TabIndex        =   170
            Top             =   960
            Width           =   2000
         End
         Begin VB.CheckBox chkLatch 
            Caption         =   "Enable Transaction Latch"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   480
            TabIndex        =   169
            Top             =   480
            Width           =   2835
         End
         Begin VB.CheckBox chkMfgAllow0 
            Caption         =   "Accept zero weight readings from scale"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   6480
            TabIndex        =   162
            Top             =   480
            Width           =   3675
         End
         Begin VB.CommandButton cmdProto 
            Caption         =   "Get Scale Protocol"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   6480
            TabIndex        =   158
            Top             =   960
            Width           =   2000
         End
         Begin VB.Label labelSALES_PRICE 
            AutoSize        =   -1  'True
            Caption         =   "SALES PRICE"
            ForeColor       =   &H00000000&
            Height          =   195
            Left            =   4080
            TabIndex        =   176
            Top             =   1780
            Width           =   1035
         End
         Begin VB.Label labelUNIT_PRICE 
            AutoSize        =   -1  'True
            Caption         =   "UNIT PRICE"
            ForeColor       =   &H00000000&
            Height          =   195
            Left            =   4080
            TabIndex        =   175
            Top             =   1420
            Width           =   915
         End
         Begin VB.Label labelWEIGHT 
            AutoSize        =   -1  'True
            Caption         =   "WEIGHT"
            ForeColor       =   &H00000000&
            Height          =   195
            Left            =   4080
            TabIndex        =   174
            Top             =   1060
            Width           =   660
         End
         Begin VB.Label lblTransactionSalesPrice 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            BeginProperty Font 
               Name            =   "Courier New"
               Size            =   9.75
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00C00000&
            Height          =   315
            Left            =   2520
            TabIndex        =   173
            Top             =   1680
            Width           =   1500
         End
         Begin VB.Label lblTransactionUnitPrice 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            BeginProperty Font 
               Name            =   "Courier New"
               Size            =   9.75
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00C00000&
            Height          =   315
            Left            =   2520
            TabIndex        =   172
            Top             =   1320
            Width           =   1500
         End
         Begin VB.Label lblTransactionWeight 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            BeginProperty Font 
               Name            =   "Courier New"
               Size            =   9.75
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00C00000&
            Height          =   315
            Left            =   2520
            TabIndex        =   171
            Top             =   960
            Width           =   1500
         End
         Begin VB.Label lblNonPort 
            Appearance      =   0  'Flat
            AutoSize        =   -1  'True
            BackColor       =   &H8000000B&
            Caption         =   "Using these vendor-specific functions will make your POS application non-portable."
            ForeColor       =   &H000000C0&
            Height          =   390
            Left            =   7320
            TabIndex        =   164
            Top             =   1920
            Width           =   4140
            WordWrap        =   -1  'True
         End
         Begin VB.Label lblProtocol 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            BeginProperty Font 
               Name            =   "Courier New"
               Size            =   9.75
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00C00000&
            Height          =   315
            Left            =   8520
            TabIndex        =   159
            Top             =   960
            Width           =   2505
         End
      End
      Begin ComctlLib.StatusBar sbrStatus 
         Height          =   315
         Index           =   0
         Left            =   360
         TabIndex        =   150
         Top             =   7920
         Width           =   11650
         _ExtentX        =   20558
         _ExtentY        =   556
         SimpleText      =   ""
         _Version        =   327682
         BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} 
            NumPanels       =   5
            BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               Object.Width           =   2187
               MinWidth        =   2187
               Text            =   "Opened: NO"
               TextSave        =   "Opened: NO"
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "Scale-device ""Open"" state"
            EndProperty
            BeginProperty Panel2 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               Object.Width           =   2187
               MinWidth        =   2187
               Text            =   "Claimed: NO"
               TextSave        =   "Claimed: NO"
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "Scale-device ""Claim"" state"
            EndProperty
            BeginProperty Panel3 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               Object.Width           =   2187
               MinWidth        =   2187
               Text            =   "Enabled: NO"
               TextSave        =   "Enabled: NO"
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "Scale-device ""Enable"" state"
            EndProperty
            BeginProperty Panel4 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               AutoSize        =   1
               Object.Width           =   6906
               Text            =   "RC: "
               TextSave        =   "RC: "
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "ResultCode"
            EndProperty
            BeginProperty Panel5 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               AutoSize        =   1
               Object.Width           =   6906
               Text            =   "RCE: "
               TextSave        =   "RCE: "
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "ResultCodeExtended"
            EndProperty
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin VB.Frame frmInitialScaleAttributes 
         Caption         =   "Initial Scale Attributes:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   3615
         Left            =   -74640
         TabIndex        =   136
         Top             =   600
         Width           =   11640
         Begin VB.CheckBox chkInitialCapZeroScale 
            Alignment       =   1  'Right Justify
            Caption         =   " CapZeroScale:"
            ForeColor       =   &H00C00000&
            Height          =   255
            Left            =   890
            TabIndex        =   146
            Top             =   3000
            Width           =   1455
         End
         Begin VB.CheckBox chkInitialCapTareWeight 
            Alignment       =   1  'Right Justify
            Caption         =   "  CapTareWeight:"
            ForeColor       =   &H00C00000&
            Height          =   255
            Left            =   770
            TabIndex        =   145
            Top             =   2700
            Width           =   1575
         End
         Begin VB.CheckBox chkInitialCapPriceCalculating 
            Alignment       =   1  'Right Justify
            Caption         =   "CapPriceCalculating:"
            ForeColor       =   &H00C00000&
            Height          =   255
            Left            =   520
            TabIndex        =   144
            Top             =   2400
            Width           =   1815
         End
         Begin VB.CheckBox chkInitialCapDisplayText 
            Alignment       =   1  'Right Justify
            Caption         =   "  CapDisplayText:"
            ForeColor       =   &H00C00000&
            Height          =   255
            Left            =   760
            TabIndex        =   143
            Top             =   2100
            Width           =   1575
         End
         Begin VB.CheckBox chkInitialCapDisplay 
            Alignment       =   1  'Right Justify
            Caption         =   " CapDisplay:"
            ForeColor       =   &H00C00000&
            Height          =   255
            Left            =   1125
            TabIndex        =   142
            Top             =   1800
            Width           =   1215
         End
         Begin VB.TextBox txtInitialMaxDisplayTextChars 
            BeginProperty Font 
               Name            =   "Courier New"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   2160
            MaxLength       =   6
            TabIndex        =   141
            Top             =   1200
            Width           =   3000
         End
         Begin VB.TextBox txtInitialMaximumWeight 
            BeginProperty Font 
               Name            =   "Courier New"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   2160
            MaxLength       =   6
            TabIndex        =   140
            Top             =   840
            Width           =   3000
         End
         Begin VB.ComboBox lstInitialWeightUnits 
            Height          =   315
            ItemData        =   "Main.frx":04CE
            Left            =   2160
            List            =   "Main.frx":04DE
            Style           =   2  'Dropdown List
            TabIndex        =   137
            Top             =   480
            Width           =   3000
         End
         Begin VB.Label lblInfo 
            Appearance      =   0  'Flat
            AutoSize        =   -1  'True
            BackColor       =   &H8000000B&
            Caption         =   "These initial scale attributes may only be set before the device is 'Opened'."
            ForeColor       =   &H000000C0&
            Height          =   390
            Left            =   7320
            TabIndex        =   163
            Top             =   3000
            Width           =   4095
            WordWrap        =   -1  'True
         End
         Begin VB.Label lblNote 
            AutoSize        =   -1  'True
            Caption         =   "(Units received from scale will always override this setting)"
            ForeColor       =   &H000000C0&
            Height          =   195
            Left            =   5300
            TabIndex        =   156
            Top             =   550
            Width           =   4065
         End
         Begin VB.Label labelInitialMaxDisplayTextChars 
            AutoSize        =   -1  'True
            Caption         =   "MaxDisplayTextChars:"
            ForeColor       =   &H00C00000&
            Height          =   195
            Left            =   480
            TabIndex        =   147
            Top             =   1300
            Width           =   1575
         End
         Begin VB.Label labelInitialMaximumWeight 
            AutoSize        =   -1  'True
            Caption         =   "MaximumWeight:"
            ForeColor       =   &H00C00000&
            Height          =   195
            Left            =   840
            TabIndex        =   139
            Top             =   940
            Width           =   1215
         End
         Begin VB.Label lblInitialUoM 
            AutoSize        =   -1  'True
            Caption         =   "WeightUnits:"
            ForeColor       =   &H00C00000&
            Height          =   195
            Left            =   1140
            TabIndex        =   138
            Top             =   580
            Width           =   915
         End
      End
      Begin VB.Frame frmDirectIO 
         Caption         =   "Service Object Direct I/O:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1455
         Left            =   -69360
         TabIndex        =   95
         Top             =   5880
         Visible         =   0   'False
         Width           =   3240
         Begin VB.ComboBox Combo3 
            Height          =   315
            ItemData        =   "Main.frx":0504
            Left            =   1200
            List            =   "Main.frx":0511
            TabIndex        =   99
            Text            =   "'pString' parameter"
            Top             =   960
            Width           =   2000
         End
         Begin VB.ComboBox Combo2 
            Height          =   315
            ItemData        =   "Main.frx":054E
            Left            =   1200
            List            =   "Main.frx":055B
            TabIndex        =   98
            Text            =   "'pData' parameter"
            Top             =   600
            Width           =   2000
         End
         Begin VB.CommandButton cmdDirectIO 
            Caption         =   "DirectIO"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   120
            TabIndex        =   97
            Top             =   240
            Width           =   1020
         End
         Begin VB.ComboBox Combo1 
            Height          =   315
            ItemData        =   "Main.frx":0598
            Left            =   1200
            List            =   "Main.frx":05A5
            TabIndex        =   96
            Text            =   "'Command' parameter"
            Top             =   240
            Width           =   2000
         End
         Begin VB.Label labelDirectIOResponse 
            AutoSize        =   -1  'True
            Caption         =   "SO response"
            ForeColor       =   &H00C00000&
            Height          =   195
            Left            =   5520
            TabIndex        =   117
            Top             =   1800
            Width           =   915
         End
         Begin VB.Label Label1 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   315
            Left            =   2160
            TabIndex        =   116
            Top             =   1680
            Width           =   3195
         End
      End
      Begin VB.Frame frmScaleProperties 
         Caption         =   "Scale Properties:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   5175
         Left            =   -74640
         TabIndex        =   68
         Top             =   600
         Width           =   11640
         Begin VB.Frame frmKeepAliveTestDisplay 
            Caption         =   "Keep-Alive Test Display"
            Height          =   1455
            Left            =   7080
            TabIndex        =   177
            Top             =   3360
            Width           =   4335
            Begin VB.Timer timKeepAliveTestDisplay 
               Enabled         =   0   'False
               Interval        =   1500
               Left            =   3480
               Top             =   960
            End
            Begin VB.CheckBox chkRunKeepAliveTestDisplay 
               Caption         =   "Run"
               Height          =   255
               Left            =   3240
               TabIndex        =   179
               Top             =   600
               Width           =   975
            End
            Begin VB.Label lblKeepAliveWeight 
               BackColor       =   &H80000018&
               BorderStyle     =   1  'Fixed Single
               BeginProperty Font 
                  Name            =   "Courier New"
                  Size            =   9.75
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               ForeColor       =   &H00C00000&
               Height          =   315
               Left            =   480
               TabIndex        =   178
               Top             =   600
               Width           =   2505
            End
         End
         Begin VB.CommandButton cmdReadSalesPrice 
            Caption         =   "read"
            Height          =   255
            Left            =   5205
            TabIndex        =   115
            Top             =   2760
            Width           =   700
         End
         Begin VB.CommandButton cmdWriteUnitPrice 
            Caption         =   "write"
            Height          =   315
            Left            =   5950
            TabIndex        =   112
            Top             =   3600
            Width           =   700
         End
         Begin VB.CommandButton cmdReadUnitPrice 
            Caption         =   "read"
            Height          =   315
            Left            =   5205
            TabIndex        =   111
            Top             =   3600
            Width           =   700
         End
         Begin VB.TextBox txtUnitPrice 
            BeginProperty DataFormat 
               Type            =   1
               Format          =   "#,##0.00;(#,##0.00)"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
            BeginProperty Font 
               Name            =   "Courier New"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   2160
            TabIndex        =   110
            Top             =   3600
            Width           =   3000
         End
         Begin VB.TextBox txtTareWeight 
            Enabled         =   0   'False
            BeginProperty Font 
               Name            =   "Courier New"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   2160
            TabIndex        =   108
            Top             =   3240
            Width           =   3000
         End
         Begin VB.CommandButton cmdWriteTareWeight 
            Caption         =   "write"
            Height          =   315
            Left            =   5950
            TabIndex        =   107
            Top             =   3240
            Width           =   700
         End
         Begin VB.CommandButton cmdReadTareWeight 
            Caption         =   "read"
            Height          =   315
            Left            =   5205
            TabIndex        =   106
            Top             =   3240
            Width           =   700
         End
         Begin VB.CheckBox chkAsyncMode 
            Alignment       =   1  'Right Justify
            Caption         =   "       AsyncMode:"
            Height          =   375
            Left            =   840
            TabIndex        =   104
            Top             =   4080
            Width           =   1500
         End
         Begin VB.Label labelMaximumWeight 
            AutoSize        =   -1  'True
            Caption         =   "MaximumWeight:"
            Height          =   195
            Left            =   860
            TabIndex        =   149
            Top             =   2220
            Width           =   1215
         End
         Begin VB.Label lblMaximumWeight 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   148
            Top             =   2160
            Width           =   3000
         End
         Begin VB.Label lblWeightUnit 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   135
            Top             =   1860
            Width           =   3000
         End
         Begin VB.Label labelWeightUnit 
            AutoSize        =   -1  'True
            Caption         =   " WeightUnit:"
            Height          =   195
            Left            =   1200
            TabIndex        =   134
            Top             =   1920
            Width           =   885
         End
         Begin VB.Label labelMaxDisplayTextChars 
            AutoSize        =   -1  'True
            Caption         =   "MaxDisplayTextChars:"
            ForeColor       =   &H00000000&
            Height          =   195
            Left            =   500
            TabIndex        =   133
            Top             =   2520
            Width           =   1575
         End
         Begin VB.Label labelCapDisplay 
            AutoSize        =   -1  'True
            Caption         =   "CapDisplay:"
            Height          =   195
            Left            =   1245
            TabIndex        =   132
            Top             =   420
            Width           =   840
         End
         Begin VB.Label labelCapDisplayText 
            AutoSize        =   -1  'True
            Caption         =   "CapDisplayText:"
            Height          =   195
            Left            =   920
            TabIndex        =   131
            Top             =   720
            Width           =   1155
         End
         Begin VB.Label labelCapPriceCalculating 
            AutoSize        =   -1  'True
            Caption         =   "CapPriceCalculating:"
            Height          =   195
            Left            =   600
            TabIndex        =   130
            Top             =   1020
            Width           =   1470
         End
         Begin VB.Label labelCapTareWeight 
            AutoSize        =   -1  'True
            Caption         =   "CapTareWeight:"
            Height          =   195
            Left            =   900
            TabIndex        =   129
            Top             =   1320
            Width           =   1170
         End
         Begin VB.Label labelCapZeroScale 
            AutoSize        =   -1  'True
            Caption         =   "CapZeroScale:"
            Height          =   195
            Left            =   1000
            TabIndex        =   128
            Top             =   1620
            Width           =   1065
         End
         Begin VB.Label lblCapDisplay 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   127
            Top             =   360
            Width           =   3000
         End
         Begin VB.Label lblCapDisplayText 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   126
            Top             =   660
            Width           =   3000
         End
         Begin VB.Label lblCapPriceCalculating 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   125
            Top             =   960
            Width           =   3000
         End
         Begin VB.Label lblCapTareWeight 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   124
            Top             =   1260
            Width           =   3000
         End
         Begin VB.Label lblCapZeroScale 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   123
            Top             =   1560
            Width           =   3000
         End
         Begin VB.Label lblMaxDisplayTextChars 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   122
            Top             =   2460
            Width           =   3000
         End
         Begin VB.Label lblSalesPrice 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            BeginProperty Font 
               Name            =   "Courier New"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   2160
            TabIndex        =   114
            Top             =   2760
            Width           =   3000
         End
         Begin VB.Label labelSalesPrice 
            AutoSize        =   -1  'True
            Caption         =   "SalesPrice:"
            Height          =   195
            Left            =   1280
            TabIndex        =   113
            Top             =   2820
            Width           =   795
         End
         Begin VB.Label labelUnitPrice 
            AutoSize        =   -1  'True
            Caption         =   "UnitPrice:"
            Height          =   195
            Left            =   1400
            TabIndex        =   109
            Top             =   3660
            Width           =   690
         End
         Begin VB.Label labelTareWeight 
            AutoSize        =   -1  'True
            Caption         =   "TareWeight:"
            Height          =   195
            Left            =   1200
            TabIndex        =   105
            Top             =   3300
            Width           =   885
         End
      End
      Begin VB.Frame frmControlObject 
         Caption         =   "Control Object:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1215
         Left            =   360
         TabIndex        =   59
         Top             =   600
         Width           =   11640
         Begin VB.Label lblCOVersion 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   63
            Top             =   360
            Width           =   3000
         End
         Begin VB.Label labelControlObjectVersion 
            AutoSize        =   -1  'True
            Caption         =   " ControlObjectVersion:"
            Height          =   195
            Left            =   480
            TabIndex        =   62
            Top             =   420
            Width           =   1575
         End
         Begin VB.Label lblCODescription 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   61
            Top             =   660
            Width           =   8895
         End
         Begin VB.Label labelControlObjectDescription 
            AutoSize        =   -1  'True
            Caption         =   "ControlObjectDescription:"
            Height          =   195
            Left            =   240
            TabIndex        =   60
            Top             =   720
            Width           =   1800
         End
      End
      Begin VB.Frame frmDetails 
         Caption         =   "Profile Details:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   3015
         Left            =   -74640
         TabIndex        =   52
         Top             =   1920
         Width           =   11640
         Begin VB.Label lblServiceDesc 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   168
            Top             =   1980
            Width           =   8895
         End
         Begin VB.Label lblServiceVer 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   167
            Top             =   1680
            Width           =   3000
         End
         Begin VB.Label labelServiceDesc 
            AutoSize        =   -1  'True
            Caption         =   "Service Description:"
            Height          =   195
            Left            =   640
            TabIndex        =   166
            Top             =   2040
            Width           =   1425
         End
         Begin VB.Label labelServiceVer 
            AutoSize        =   -1  'True
            Caption         =   "Service Version:"
            Height          =   195
            Left            =   920
            TabIndex        =   165
            Top             =   1740
            Width           =   1155
         End
         Begin VB.Label lblAdminVersion 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   155
            Top             =   1080
            Width           =   3000
         End
         Begin VB.Label Label7 
            AutoSize        =   -1  'True
            Caption         =   "Admin Version:"
            Height          =   195
            Left            =   1030
            TabIndex        =   154
            Top             =   1140
            Width           =   1050
         End
         Begin VB.Label labelProgID 
            AutoSize        =   -1  'True
            Caption         =   "Prog ID:"
            Height          =   195
            Left            =   1520
            TabIndex        =   119
            Top             =   540
            Width           =   585
         End
         Begin VB.Label lblProgID 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   118
            Top             =   480
            Width           =   8895
         End
         Begin VB.Label lblModel 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   58
            Top             =   2280
            Width           =   3000
         End
         Begin VB.Label lblService 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   57
            Top             =   1380
            Width           =   3000
         End
         Begin VB.Label lblDescription 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   56
            Top             =   780
            Width           =   8895
         End
         Begin VB.Label labelModel 
            AutoSize        =   -1  'True
            Caption         =   "Model Number:"
            Height          =   195
            Left            =   1005
            TabIndex        =   55
            Top             =   2340
            Width           =   1080
         End
         Begin VB.Label labelService 
            AutoSize        =   -1  'True
            Caption         =   "Service Object:"
            Height          =   195
            Left            =   990
            TabIndex        =   54
            Top             =   1440
            Width           =   1095
         End
         Begin VB.Label labelDescription 
            AutoSize        =   -1  'True
            Caption         =   "Description:"
            Height          =   195
            Left            =   1250
            TabIndex        =   53
            Top             =   840
            Width           =   840
         End
      End
      Begin VB.Timer timCommTimeout 
         Enabled         =   0   'False
         Interval        =   1000
         Left            =   -66840
         Top             =   4920
      End
      Begin MSCommLib.MSComm MSComm1 
         Left            =   -66240
         Top             =   4800
         _ExtentX        =   1005
         _ExtentY        =   1005
         _Version        =   393216
         CommPort        =   2
         DTREnable       =   -1  'True
         ParitySetting   =   2
         DataBits        =   7
      End
      Begin VB.Frame frmTest 
         Caption         =   "Test:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   2415
         Left            =   -74640
         TabIndex        =   45
         Top             =   1920
         Width           =   11535
         Begin VB.CommandButton cmdScaleTestSend 
            Caption         =   "Send"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   5640
            TabIndex        =   48
            ToolTipText     =   "New Device Instance"
            Top             =   720
            Width           =   1185
         End
         Begin VB.ComboBox lstScaleTestScaleFunction 
            Height          =   315
            ItemData        =   "Main.frx":05E2
            Left            =   480
            List            =   "Main.frx":0610
            Style           =   2  'Dropdown List
            TabIndex        =   46
            Top             =   720
            Width           =   5000
         End
         Begin VB.Label labelScaleTestScaleResponse 
            AutoSize        =   -1  'True
            Caption         =   "Scale Response:"
            Height          =   195
            Left            =   480
            TabIndex        =   50
            Top             =   1320
            Width           =   1215
         End
         Begin VB.Label lblScaleTestScaleResponse 
            BackColor       =   &H00000000&
            BorderStyle     =   1  'Fixed Single
            BeginProperty Font 
               Name            =   "Courier New"
               Size            =   12
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H0000FF00&
            Height          =   330
            Left            =   480
            TabIndex        =   49
            Top             =   1560
            Width           =   10560
         End
         Begin VB.Label labelScaleTestScaleFunction 
            AutoSize        =   -1  'True
            Caption         =   "Scale Function:"
            Height          =   195
            Left            =   480
            TabIndex        =   47
            Top             =   480
            Width           =   1110
         End
      End
      Begin VB.Frame Frame8 
         Caption         =   "Serial Communications:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1215
         Left            =   -74640
         TabIndex        =   38
         Top             =   600
         Width           =   9375
         Begin VB.ComboBox lstScaleTestDataBits 
            Height          =   315
            ItemData        =   "Main.frx":0791
            Left            =   4320
            List            =   "Main.frx":079B
            Style           =   2  'Dropdown List
            TabIndex        =   152
            Top             =   600
            Width           =   1600
         End
         Begin VB.ComboBox lstScaleTestParity 
            Height          =   315
            ItemData        =   "Main.frx":07A5
            Left            =   6240
            List            =   "Main.frx":07B2
            Style           =   2  'Dropdown List
            TabIndex        =   41
            Top             =   600
            Width           =   1600
         End
         Begin VB.ComboBox lstScaleTestBaudRate 
            Height          =   315
            ItemData        =   "Main.frx":07C7
            Left            =   2400
            List            =   "Main.frx":07DA
            Style           =   2  'Dropdown List
            TabIndex        =   40
            Top             =   600
            Width           =   1600
         End
         Begin VB.ComboBox lstScaleTestSerialPort 
            Height          =   315
            ItemData        =   "Main.frx":07FD
            Left            =   480
            List            =   "Main.frx":081F
            Style           =   2  'Dropdown List
            TabIndex        =   39
            Top             =   600
            Width           =   1600
         End
         Begin VB.Label labelScaleTestDataBits 
            AutoSize        =   -1  'True
            Caption         =   "Data Bits:"
            Height          =   195
            Left            =   4320
            TabIndex        =   153
            Top             =   360
            Width           =   690
         End
         Begin VB.Label labelScaleTestParity 
            AutoSize        =   -1  'True
            Caption         =   "Parity:"
            Height          =   195
            Left            =   6240
            TabIndex        =   44
            Top             =   360
            Width           =   435
         End
         Begin VB.Label labelScaleTestBaudRate 
            AutoSize        =   -1  'True
            Caption         =   "Baud Rate:"
            Height          =   195
            Left            =   2400
            TabIndex        =   43
            Top             =   360
            Width           =   810
         End
         Begin VB.Label labelScaleTestSerialPort 
            AutoSize        =   -1  'True
            Caption         =   "Serial Port:"
            Height          =   195
            Left            =   480
            TabIndex        =   42
            Top             =   360
            Width           =   765
         End
      End
      Begin VB.Frame frmScaleMethods 
         Caption         =   "Scale Methods:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1935
         Left            =   -74640
         TabIndex        =   34
         Top             =   5880
         Width           =   11640
         Begin VB.TextBox txtDisplayText 
            Height          =   315
            Left            =   8040
            TabIndex        =   103
            Text            =   "'Text' parameter"
            Top             =   720
            Width           =   2500
         End
         Begin VB.CommandButton cmdDisplayText 
            Caption         =   "DisplayText"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   6480
            TabIndex        =   102
            Top             =   720
            Width           =   1500
         End
         Begin VB.ComboBox lstReadWeightTimeout 
            Height          =   315
            ItemData        =   "Main.frx":0860
            Left            =   2160
            List            =   "Main.frx":08D9
            TabIndex        =   100
            Text            =   "'Timeout' parameter"
            Top             =   840
            Width           =   2500
         End
         Begin VB.CommandButton cmdZeroScale 
            Caption         =   "ZeroScale"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   600
            TabIndex        =   36
            Top             =   1320
            Width           =   1500
         End
         Begin VB.CommandButton cmdReadWeight 
            Caption         =   "ReadWeight"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   600
            TabIndex        =   35
            Top             =   840
            Width           =   1500
         End
         Begin VB.Label labelWeightData 
            AutoSize        =   -1  'True
            Caption         =   "Weight Data"
            ForeColor       =   &H00C00000&
            Height          =   195
            Left            =   4780
            TabIndex        =   101
            Top             =   600
            Width           =   900
         End
         Begin VB.Label lblWeight 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            BeginProperty Font 
               Name            =   "Courier New"
               Size            =   9.75
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00C00000&
            Height          =   315
            Left            =   2160
            TabIndex        =   37
            Top             =   480
            Width           =   2500
         End
      End
      Begin VB.Frame frmCommonMethods 
         Caption         =   "Common Methods:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1455
         Left            =   360
         TabIndex        =   29
         Top             =   6360
         Width           =   11640
         Begin VB.ComboBox lstCheckHealth 
            Height          =   315
            ItemData        =   "Main.frx":0992
            Left            =   8040
            List            =   "Main.frx":099F
            TabIndex        =   94
            Text            =   "'Level' parameter"
            Top             =   360
            Width           =   3000
         End
         Begin VB.CommandButton cmdCheckHealth 
            Caption         =   "CheckHealth"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   6480
            TabIndex        =   93
            Top             =   360
            Width           =   1500
         End
         Begin VB.CommandButton cmdClearInput 
            Caption         =   "ClearInput"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   6480
            TabIndex        =   92
            Top             =   840
            Width           =   1500
         End
         Begin VB.ComboBox lstClaimTimeout 
            Height          =   315
            ItemData        =   "Main.frx":09DC
            Left            =   3840
            List            =   "Main.frx":0A55
            TabIndex        =   86
            Text            =   "'Timeout' parameter"
            Top             =   360
            Width           =   2100
         End
         Begin VB.CommandButton cmdOpen 
            Caption         =   "Open"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   480
            TabIndex        =   33
            Top             =   360
            Width           =   1500
         End
         Begin VB.CommandButton cmdClaimDevice 
            Caption         =   "ClaimDevice"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   2280
            TabIndex        =   32
            Top             =   360
            Width           =   1500
         End
         Begin VB.CommandButton cmdReleaseDevice 
            Caption         =   "ReleaseDevice"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   2280
            TabIndex        =   31
            Top             =   840
            Width           =   1500
         End
         Begin VB.CommandButton cmdClose 
            Caption         =   "Close"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   480
            TabIndex        =   30
            Top             =   840
            Width           =   1500
         End
      End
      Begin VB.Frame frmCommonProperties 
         Caption         =   "Common Properties:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   4335
         Left            =   360
         TabIndex        =   18
         Top             =   1920
         Width           =   11640
         Begin VB.ComboBox lstPowerNotify 
            Height          =   315
            ItemData        =   "Main.frx":0B1A
            Left            =   8040
            List            =   "Main.frx":0B24
            Style           =   2  'Dropdown List
            TabIndex        =   89
            Top             =   3000
            Width           =   3000
         End
         Begin VB.ComboBox lstBinaryConversion 
            Height          =   315
            ItemData        =   "Main.frx":0B4B
            Left            =   8040
            List            =   "Main.frx":0B58
            Style           =   2  'Dropdown List
            TabIndex        =   88
            Top             =   3360
            Width           =   3000
         End
         Begin VB.CheckBox chkAutoDisable 
            Alignment       =   1  'Right Justify
            Caption         =   " AutoDisable:"
            Height          =   300
            Left            =   3880
            TabIndex        =   87
            Top             =   3360
            Width           =   1260
         End
         Begin VB.CheckBox chkDataEventEnabled 
            Alignment       =   1  'Right Justify
            Caption         =   " DataEventEnabled:"
            Height          =   300
            Left            =   600
            TabIndex        =   85
            Top             =   3060
            Width           =   1740
         End
         Begin VB.CheckBox chkFreezeEvents 
            Alignment       =   1  'Right Justify
            Caption         =   " FreezeEvents:"
            Height          =   300
            Left            =   3760
            TabIndex        =   84
            Top             =   3060
            Width           =   1380
         End
         Begin VB.CheckBox chkDeviceEnabled 
            Alignment       =   1  'Right Justify
            Caption         =   " DeviceEnabled:"
            Height          =   300
            Left            =   840
            TabIndex        =   83
            Top             =   3360
            Width           =   1500
         End
         Begin VB.CommandButton cmdRefreshState 
            Caption         =   "refresh"
            Height          =   255
            Left            =   5280
            TabIndex        =   82
            Top             =   1860
            Width           =   700
         End
         Begin VB.CommandButton cmdRefreshDataCount 
            Caption         =   "refresh"
            Height          =   255
            Left            =   5280
            TabIndex        =   75
            Top             =   2160
            Width           =   700
         End
         Begin VB.Label labelPowerNotify 
            AutoSize        =   -1  'True
            Caption         =   "PowerNotify:"
            Height          =   195
            Left            =   7050
            TabIndex        =   91
            Top             =   3060
            Width           =   900
         End
         Begin VB.Label labelBinaryConversion 
            AutoSize        =   -1  'True
            Caption         =   "BinaryConversion:"
            Height          =   195
            Left            =   6680
            TabIndex        =   90
            Top             =   3420
            Width           =   1275
         End
         Begin VB.Label lblState 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   81
            Top             =   1860
            Width           =   3000
         End
         Begin VB.Label labelState 
            AutoSize        =   -1  'True
            Caption         =   "  State:"
            Height          =   195
            Left            =   1560
            TabIndex        =   80
            Top             =   1920
            Width           =   510
         End
         Begin VB.Label lblResultCodeExtended 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   79
            Top             =   2760
            Width           =   3000
         End
         Begin VB.Label labelResultCodeExtended 
            AutoSize        =   -1  'True
            Caption         =   "ResultCodeExtended:"
            Height          =   195
            Index           =   0
            Left            =   520
            TabIndex        =   78
            Top             =   2820
            Width           =   1545
         End
         Begin VB.Label lblResultCode 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   77
            Top             =   2460
            Width           =   3000
         End
         Begin VB.Label labelResultCode 
            AutoSize        =   -1  'True
            Caption         =   "ResultCode:"
            Height          =   195
            Index           =   0
            Left            =   1200
            TabIndex        =   76
            Top             =   2520
            Width           =   870
         End
         Begin VB.Label lblDataCount 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   74
            Top             =   2160
            Width           =   3000
         End
         Begin VB.Label labelDataCount 
            AutoSize        =   -1  'True
            Caption         =   "DataCount:"
            Height          =   195
            Left            =   1245
            TabIndex        =   73
            Top             =   2220
            Width           =   810
         End
         Begin VB.Label lblCheckHealthText 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   72
            Top             =   3720
            Width           =   8895
         End
         Begin VB.Label labelCheckHealthText 
            AutoSize        =   -1  'True
            Caption         =   "CheckHealthText:"
            Height          =   195
            Left            =   760
            TabIndex        =   71
            Top             =   3755
            Width           =   1290
         End
         Begin VB.Label lblClaimed 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   8040
            TabIndex        =   70
            Top             =   2460
            Width           =   3000
         End
         Begin VB.Label labelClaimed 
            AutoSize        =   -1  'True
            Caption         =   "   Claimed:"
            Height          =   195
            Left            =   7210
            TabIndex        =   69
            Top             =   2520
            Width           =   735
         End
         Begin VB.Label lblPowerState 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   8040
            TabIndex        =   67
            Top             =   2160
            Width           =   3000
         End
         Begin VB.Label labelPowerState 
            AutoSize        =   -1  'True
            Caption         =   "PowerState:"
            Height          =   195
            Left            =   7080
            TabIndex        =   66
            Top             =   2220
            Width           =   870
         End
         Begin VB.Label labelOpenResult 
            AutoSize        =   -1  'True
            Caption         =   "OpenResult:"
            Height          =   195
            Left            =   1200
            TabIndex        =   65
            Top             =   420
            Width           =   885
         End
         Begin VB.Label lblOpenResult 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   64
            Top             =   360
            Width           =   3000
         End
         Begin VB.Label labelServiceObjectVersion 
            AutoSize        =   -1  'True
            Caption         =   "ServiceObjectVersion:"
            Height          =   195
            Left            =   490
            TabIndex        =   28
            Top             =   720
            Width           =   1575
         End
         Begin VB.Label lblServiceObjectVersion 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   27
            Top             =   660
            Width           =   3000
         End
         Begin VB.Label labelServiceObjectDescription 
            AutoSize        =   -1  'True
            Caption         =   "ServiceObjectDescription:"
            Height          =   195
            Left            =   220
            TabIndex        =   26
            Top             =   1020
            Width           =   1845
         End
         Begin VB.Label lblServiceObjectDescription 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   25
            Top             =   960
            Width           =   8895
         End
         Begin VB.Label labelDeviceName 
            AutoSize        =   -1  'True
            Caption         =   "DeviceName:"
            Height          =   195
            Left            =   1080
            TabIndex        =   24
            Top             =   1320
            Width           =   975
         End
         Begin VB.Label labelDeviceDescription 
            AutoSize        =   -1  'True
            Caption         =   "DeviceDescription:"
            Height          =   195
            Left            =   720
            TabIndex        =   23
            Top             =   1620
            Width           =   1350
         End
         Begin VB.Label lblDeviceName 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   22
            Top             =   1260
            Width           =   8895
         End
         Begin VB.Label lblDeviceDescription 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   2160
            TabIndex        =   21
            Top             =   1560
            Width           =   8895
         End
         Begin VB.Label labelCapPowerReporting 
            AutoSize        =   -1  'True
            Caption         =   "CapPowerReporting:"
            Height          =   195
            Left            =   6490
            TabIndex        =   20
            Top             =   1920
            Width           =   1470
         End
         Begin VB.Label lblCapPowerReporting 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Height          =   255
            Left            =   8040
            TabIndex        =   19
            Top             =   1860
            Width           =   3000
         End
      End
      Begin VB.Frame frmLogging 
         Caption         =   "Logging:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1095
         Left            =   -74640
         TabIndex        =   12
         Top             =   7080
         Visible         =   0   'False
         Width           =   6375
         Begin VB.ComboBox lstVerbosity 
            Height          =   315
            ItemData        =   "Main.frx":0B8B
            Left            =   1200
            List            =   "Main.frx":0B9E
            Style           =   2  'Dropdown List
            TabIndex        =   14
            Top             =   600
            Width           =   3375
         End
         Begin VB.CommandButton btnSetLogFile 
            Caption         =   "&Set Log File"
            Height          =   315
            Left            =   4680
            TabIndex        =   13
            ToolTipText     =   "New Device Instance"
            Top             =   240
            Width           =   1185
         End
         Begin VB.Label Label4 
            Caption         =   "Log File:"
            Height          =   375
            Left            =   360
            TabIndex        =   17
            Top             =   240
            Width           =   735
         End
         Begin VB.Label Label5 
            Caption         =   "Verbosity:"
            Height          =   255
            Left            =   240
            TabIndex        =   16
            Top             =   600
            Width           =   855
         End
         Begin VB.Label lblLogFile 
            BackColor       =   &H80000018&
            BorderStyle     =   1  'Fixed Single
            Caption         =   "c:\OposAdmin.log"
            Height          =   315
            Left            =   1200
            TabIndex        =   15
            Top             =   240
            Width           =   3375
         End
      End
      Begin VB.Frame frmSerialCommunications 
         Caption         =   "Serial Communications:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1455
         Left            =   -74640
         TabIndex        =   5
         Top             =   5040
         Width           =   11640
         Begin VB.ComboBox lstDataBits 
            Height          =   315
            ItemData        =   "Main.frx":0C3F
            Left            =   6000
            List            =   "Main.frx":0C49
            Style           =   2  'Dropdown List
            TabIndex        =   120
            Top             =   720
            Width           =   1600
         End
         Begin VB.ComboBox lstSerialPort 
            Height          =   315
            ItemData        =   "Main.frx":0C53
            Left            =   2160
            List            =   "Main.frx":0C75
            Style           =   2  'Dropdown List
            TabIndex        =   8
            Top             =   720
            Width           =   1600
         End
         Begin VB.ComboBox lstBaudRate 
            Height          =   315
            ItemData        =   "Main.frx":0CB6
            Left            =   4080
            List            =   "Main.frx":0CC9
            Style           =   2  'Dropdown List
            TabIndex        =   7
            Top             =   720
            Width           =   1600
         End
         Begin VB.ComboBox lstParity 
            Height          =   315
            ItemData        =   "Main.frx":0CEC
            Left            =   7920
            List            =   "Main.frx":0CF9
            Style           =   2  'Dropdown List
            TabIndex        =   6
            Top             =   720
            Width           =   1600
         End
         Begin VB.Label Label2 
            AutoSize        =   -1  'True
            Caption         =   "Data Bits"
            Height          =   195
            Left            =   6000
            TabIndex        =   121
            Top             =   480
            Width           =   645
         End
         Begin VB.Label labelSerialPort 
            AutoSize        =   -1  'True
            Caption         =   "Serial Port:"
            Height          =   195
            Left            =   2160
            TabIndex        =   11
            Top             =   480
            Width           =   765
         End
         Begin VB.Label Label3 
            AutoSize        =   -1  'True
            Caption         =   "Baud Rate:"
            Height          =   195
            Left            =   4080
            TabIndex        =   10
            Top             =   480
            Width           =   810
         End
         Begin VB.Label Label6 
            AutoSize        =   -1  'True
            Caption         =   "Parity:"
            Height          =   195
            Left            =   7920
            TabIndex        =   9
            Top             =   480
            Width           =   435
         End
      End
      Begin VB.Frame frmScaleInstance 
         Caption         =   "Scale/SO Instance:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1215
         Left            =   -74640
         TabIndex        =   1
         Top             =   600
         Width           =   11640
         Begin VB.ComboBox lstProfiles 
            Height          =   315
            ItemData        =   "Main.frx":0D0E
            Left            =   480
            List            =   "Main.frx":0D10
            Sorted          =   -1  'True
            Style           =   2  'Dropdown List
            TabIndex        =   4
            Top             =   600
            Width           =   3500
         End
         Begin VB.CommandButton btnAdd 
            Caption         =   "&Add"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   4200
            TabIndex        =   3
            ToolTipText     =   "New Device Instance"
            Top             =   600
            Width           =   1185
         End
         Begin VB.CommandButton btnRemove 
            Caption         =   "&Remove"
            Enabled         =   0   'False
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   5520
            TabIndex        =   2
            ToolTipText     =   "Delete Device Instance"
            Top             =   600
            Width           =   1185
         End
         Begin VB.Label labelProfileName 
            AutoSize        =   -1  'True
            Caption         =   "Profile Name:"
            Height          =   195
            Left            =   480
            TabIndex        =   51
            Top             =   345
            Width           =   945
         End
      End
      Begin ComctlLib.StatusBar sbrStatus 
         Height          =   315
         Index           =   1
         Left            =   -74640
         TabIndex        =   151
         Top             =   7920
         Width           =   11650
         _ExtentX        =   20558
         _ExtentY        =   556
         SimpleText      =   ""
         _Version        =   327682
         BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} 
            NumPanels       =   5
            BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               Object.Width           =   2187
               MinWidth        =   2187
               Text            =   "Opened: NO"
               TextSave        =   "Opened: NO"
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "Scale-device ""Open"" state"
            EndProperty
            BeginProperty Panel2 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               Object.Width           =   2187
               MinWidth        =   2187
               Text            =   "Claimed: NO"
               TextSave        =   "Claimed: NO"
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "Scale-device ""Claim"" state"
            EndProperty
            BeginProperty Panel3 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               Object.Width           =   2187
               MinWidth        =   2187
               Text            =   "Enabled: NO"
               TextSave        =   "Enabled: NO"
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "Scale-device ""Enable"" state"
            EndProperty
            BeginProperty Panel4 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               AutoSize        =   1
               Object.Width           =   6906
               Text            =   "RC: "
               TextSave        =   "RC: "
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "ResultCode"
            EndProperty
            BeginProperty Panel5 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               AutoSize        =   1
               Object.Width           =   6906
               Text            =   "RCE: "
               TextSave        =   "RCE: "
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "ResultCodeExtended"
            EndProperty
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin ComctlLib.StatusBar sbrStatus 
         Height          =   315
         Index           =   2
         Left            =   -65280
         TabIndex        =   160
         Top             =   7320
         Visible         =   0   'False
         Width           =   1935
         _ExtentX        =   3413
         _ExtentY        =   556
         SimpleText      =   ""
         _Version        =   327682
         BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} 
            NumPanels       =   5
            BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               Object.Width           =   2187
               MinWidth        =   2187
               Text            =   "Opened: NO"
               TextSave        =   "Opened: NO"
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "Scale-device ""Open"" state"
            EndProperty
            BeginProperty Panel2 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               Object.Width           =   2187
               MinWidth        =   2187
               Text            =   "Claimed: NO"
               TextSave        =   "Claimed: NO"
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "Scale-device ""Claim"" state"
            EndProperty
            BeginProperty Panel3 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               Object.Width           =   2187
               MinWidth        =   2187
               Text            =   "Enabled: NO"
               TextSave        =   "Enabled: NO"
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "Scale-device ""Enable"" state"
            EndProperty
            BeginProperty Panel4 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               AutoSize        =   1
               Text            =   "RC: "
               TextSave        =   "RC: "
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "ResultCode"
            EndProperty
            BeginProperty Panel5 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               AutoSize        =   1
               Text            =   "RCE: "
               TextSave        =   "RCE: "
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "ResultCodeExtended"
            EndProperty
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin ComctlLib.StatusBar sbrStatus 
         Height          =   315
         Index           =   3
         Left            =   -74640
         TabIndex        =   161
         Top             =   7920
         Width           =   11655
         _ExtentX        =   20558
         _ExtentY        =   556
         SimpleText      =   ""
         _Version        =   327682
         BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} 
            NumPanels       =   5
            BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               Object.Width           =   2187
               MinWidth        =   2187
               Text            =   "Opened: NO"
               TextSave        =   "Opened: NO"
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "Scale-device ""Open"" state"
            EndProperty
            BeginProperty Panel2 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               Object.Width           =   2187
               MinWidth        =   2187
               Text            =   "Claimed: NO"
               TextSave        =   "Claimed: NO"
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "Scale-device ""Claim"" state"
            EndProperty
            BeginProperty Panel3 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               Object.Width           =   2187
               MinWidth        =   2187
               Text            =   "Enabled: NO"
               TextSave        =   "Enabled: NO"
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "Scale-device ""Enable"" state"
            EndProperty
            BeginProperty Panel4 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               AutoSize        =   1
               Object.Width           =   6906
               Text            =   "RC: "
               TextSave        =   "RC: "
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "ResultCode"
            EndProperty
            BeginProperty Panel5 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
               AutoSize        =   1
               Object.Width           =   6906
               Text            =   "RCE: "
               TextSave        =   "RCE: "
               Key             =   ""
               Object.Tag             =   ""
               Object.ToolTipText     =   "ResultCodeExtended"
            EndProperty
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
   End
   Begin VB.Menu mnuFile 
      Caption         =   "&File"
      Begin VB.Menu mnuRefreshDeviceNames 
         Caption         =   "&Refresh Device Names"
      End
      Begin VB.Menu mnuSep1 
         Caption         =   "-"
      End
      Begin VB.Menu mnuFileExit 
         Caption         =   "E&xit"
      End
   End
   Begin VB.Menu mnuHelp 
      Caption         =   "&Help"
      Begin VB.Menu mnuHelpAbout 
         Caption         =   "&About WTScaleAdmin..."
      End
   End
End
Attribute VB_Name = "winMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public WithEvents OPOSScale1 As OPOSScale
Attribute OPOSScale1.VB_VarHelpID = -1

Private mlng_AdminMajorVersion As Long
Private mlng_AdminMinorVersion As Long
Private mlng_AdminBuildVersion As Long
Public mlng_AdminVersion As Long

Private curInstance As Integer

Private mbln_DeviceIsOpen As Boolean
Private mbln_DeviceIsClaimed As Boolean
Private mbln_DeviceIsEnabled As Boolean

Private mlng_ResultCode As Long
Private mlng_ResultCodeExtended As Long

Private mlng_Weight As Long

Private Const COLOR_RED = &HC0&
Private Const COLOR_GREEN = &HC000&

Private Const BOX_UNCHECKED = 0
Private Const BOX_CHECKED = 1
Private Const BOX_GRAYED = 2

Private Const ASCII_BS = &H8
Private Const ASCII_LF = &HA
Private Const ASCII_CR = &HD

' Status bar constant definitions:
' Note: There seems to be a bug with the StatusBar control. Adding third control (as index 2) did not
'       work. Had to add a fourth control and use it as index 3.
Private Const COMMON_PANEL = 0
Private Const SPECIFIC_PANEL = 1
Private Const ADVANCED_PANEL = 3                'see note

Private Const OPENED_STATUS = 1
Private Const CLAIMED_STATUS = 2
Private Const ENABLED_STATUS = 3
Private Const RC_STATUS = 4
Private Const RCE_STATUS = 5

Private winMainHeight As Long
Private winMainWidth As Long

Sub SelectDevice(devName As String)
    
    ' We want to search through our internal collection of devices, and match up the currently selected
    ' one (indexed by name), and set the global index for the currently selected one.
    
    Dim i As Integer
    
    i = 1
    curInstance = 0
    
    While (i <= lstProfiles.ListCount And curInstance = 0)
        If (UCase(arrInstances(i).szDevName) = UCase(devName)) Then
            curInstance = i
        End If
        i = i + 1
    Wend
    
End Sub
    
Private Sub btnRemove_Click()

    ' Delete the currently selected Device Instance:
    
    If (lstProfiles.ListCount < 1) Then
        'Check if there are no instances available
        MsgBox "No devices to delete."
    Else
        'Delete the currently selected instance
        RemoveInstance
        
        'Force an update on the current instance
        lstProfiles_Click
    End If
    
    If (lstProfiles.ListCount < 1) Then
        EnableAddControls True
    End If
    
End Sub

Private Sub btnAdd_Click()
    
    'Create a new Device Instance:
        
    Dim winAddInstanceObj As New winAddInstance
    Dim devName As String
    
    winAddInstanceObj.Show vbModal
    
    devName = winAddInstanceObj.GetDevName
    
    If (Len(devName) > 0) Then
        
        AddInstance devName
        
        If (lstProfiles.ListCount > 0) Then
        'The following controls are available to the user only when the device instance list contains at
        'least one device.
        'Enable the serial port buttons.
        'Transfer focus to the com port drop-down box winMain.lstSerialPort.SetFocus
        End If
        
    End If
    
    'Update the device instance displayed on the 'Scale Profile' tab
    Call RefreshDeviceNames

    Unload winAddInstanceObj
    Set winAddInstanceObj = Nothing
    
End Sub

Private Sub chkAsyncMode_Click()

    Dim bAM As Boolean
    
    'Attempt to set/clear the property:
    If (chkAsyncMode.Value = BOX_CHECKED) Then
        OPOSScale1.AsyncMode = True
    Else
        OPOSScale1.AsyncMode = False
    End If
 
    Call GetResultCodes
    
    'Indicate an error if setting did not work:
    If (mlng_ResultCode <> OPOS_SUCCESS) Then
    End If
    
    'Now, read back and indicate the actual property from the SO:
    bAM = OPOSScale1.AsyncMode
    If (bAM = True) Then
        chkAsyncMode.Value = BOX_CHECKED
    Else
        chkAsyncMode.Value = BOX_UNCHECKED
    End If

End Sub

Private Sub chkInitialCapPriceCalculating_Click()

    Dim ret As Long
    Dim devName As String
    Dim szValue As String
    
    'Set the initial CapPriceCalculating property for the scale:
    devName = lstProfiles.Text
    
    If (devName = "") Then
        chkInitialCapPriceCalculating.Value = BOX_UNCHECKED              'defaut "NO" for new instance
    End If
        
    If (chkInitialCapPriceCalculating.Value = BOX_CHECKED) Then
        szValue = "YES"
    Else
        szValue = "NO"
    End If
    
    ret = SetOPOSRegValue(devClass, devName, "Initial_CapPriceCalculating", szValue, "")
    
End Sub

Private Sub chkInitialCapDisplay_Click()

    Dim ret As Long
    Dim devName As String
    Dim szValue As String
    
    'Set the initial CapDisplay property for the scale:
    devName = lstProfiles.Text
    
    If (devName = "") Then
        chkInitialCapDisplay.Value = BOX_CHECKED                    'defaut "YES" for new instance
    End If
        
    If (chkInitialCapDisplay.Value = BOX_CHECKED) Then
        szValue = "YES"
    Else
        szValue = "NO"
    End If
    
    ret = SetOPOSRegValue(devClass, devName, "Initial_CapDisplay", szValue, "")
    
End Sub

Private Sub chkInitialCapDisplayText_Click()

    Dim ret As Long
    Dim devName As String
    Dim szValue As String
    
    'Set the initial CapDisplayText property for the scale:
    devName = lstProfiles.Text
    
    If (devName = "") Then
        chkInitialCapDisplayText.Value = BOX_UNCHECKED              'defaut "NO" for new instance
    End If
        
    If (chkInitialCapDisplayText.Value = BOX_CHECKED) Then
        szValue = "YES"
    Else
        szValue = "NO"
    End If
    
    ret = SetOPOSRegValue(devClass, devName, "Initial_CapDisplayText", szValue, "")
    
End Sub

Private Sub chkInitialCapTareWeight_Click()

    Dim ret As Long
    Dim devName As String
    Dim szValue As String
    
    'Set the initial CapTareWeight property for the scale:
    devName = lstProfiles.Text
    
    If (devName = "") Then
        chkInitialCapTareWeight.Value = BOX_UNCHECKED              'defaut "NO" for new instance
    End If
        
    If (chkInitialCapTareWeight.Value = BOX_CHECKED) Then
        szValue = "YES"
    Else
        szValue = "NO"
    End If
    
    ret = SetOPOSRegValue(devClass, devName, "Initial_CapTareWeight", szValue, "")
    
End Sub

Private Sub chkInitialCapZeroScale_Click()

    Dim ret As Long
    Dim devName As String
    Dim szValue As String
    
    'Set the initial CapZeroScale property for the scale:
    devName = lstProfiles.Text
    
    If (devName = "") Then
        chkInitialCapZeroScale.Value = BOX_CHECKED              'defaut "YES" for new instance
    End If
        
    If (chkInitialCapZeroScale.Value = BOX_CHECKED) Then
        szValue = "YES"
    Else
        szValue = "NO"
    End If
    
    ret = SetOPOSRegValue(devClass, devName, "Initial_CapZeroScale", szValue, "")
    
End Sub

Private Sub chkLatch_Click()

    Dim lret As Long
    
    If (chkLatch.Value = BOX_CHECKED) Then
        lret = OPOSScale1.DirectIO(WT_MfgCmd_EnableTransactionLatch, 0, "")
    Else
        lret = OPOSScale1.DirectIO(WT_MfgCmd_DisableTransactionLatch, 0, "")
    End If
    
    Call GetMfgResultCodes
    
End Sub

Private Sub chkMfgAllow0_Click()

    Dim lret As Long
    
    If (chkMfgAllow0.Value = BOX_CHECKED) Then
        lret = OPOSScale1.DirectIO(WT_MfgCmd_0Wt_Valid, 0, "")
    Else
        lret = OPOSScale1.DirectIO(WT_MfgCmd_0Wt_NotValid, 0, "")
    End If

    Call GetMfgResultCodes

End Sub

Private Sub chkRunKeepAliveTestDisplay_Click()

    If (chkRunKeepAliveTestDisplay.Value = vbChecked) Then
        timKeepAliveTestDisplay.Enabled = True
    Else
        timKeepAliveTestDisplay.Enabled = False
    End If

End Sub

Private Sub cmdDisplayText_Click()

    Dim lret As Long
    Dim msg As String
    Dim bCapDisplayText As Boolean
    
    bCapDisplayText = OPOSScale1.CapDisplayText
    If (bCapDisplayText = True) Then
        lret = OPOSScale1.DisplayText(txtDisplayText.Text)
        Call GetResultCodes
    Else
        msg = "Scale text display capability not currently supported."
        MsgBox msg, vbInformation, "Scale Capability Error"
    End If
    
End Sub

Private Sub cmdGetTransaction_Click()

    Dim lret As Long
    Dim lTimeout As Long
    
    'Determines the number of milliseconds to wait for a settled weight/transaction.
    'This value is borrowed from the ReadWeight timeout listbox on the Specifics tab.
    lTimeout = lstReadWeightTimeout.ItemData(lstReadWeightTimeout.ListIndex)

    lret = OPOSScale1.DirectIO(WT_MfgCmd_ReadTransaction, lTimeout, "")
    If (lret = OPOS_SUCCESS) Then
        Call cmdReadWeight_Click
        lblTransactionWeight.Caption = Format$(mlng_Weight, "000")
        
        Call cmdReadUnitPrice_Click
        lblTransactionUnitPrice.Caption = txtUnitPrice.Text
        
        Call cmdReadSalesPrice_Click
        lblTransactionSalesPrice.Caption = lblSalesPrice.Caption
    Else
        lblTransactionWeight.Caption = "0"
        lblTransactionUnitPrice.Caption = "0"
        lblTransactionSalesPrice.Caption = "0"
    End If

    Call GetMfgResultCodes

End Sub

Private Sub cmdProto_Click()

    'Uses a vendor-specific command.
    
    Dim lret As Long
    Dim msg As String
    
    lret = OPOSScale1.DirectIO(WT_MfgCmd_SIOProtocol, 0, "")
    If (lret = OPOS_SUCCESS) Then
        Call GetMfgResultCodes
        
        Select Case (mlng_ResultCodeExtended)
            Case WT_MFG_ECRPROTO
                lblProtocol.Caption = "WT_MFG_ECRPROTO"
            Case WT_MFG_OPOSPROTO
                lblProtocol.Caption = "WT_MFG_OPOSPROTO"
            Case Else
                lblProtocol.Caption = "Mfg RCE Error"
        End Select
    Else
        Beep
        msg = "Sorry, this vendor-specific command is only available after the device is " & Chr(10)
        msg = msg & "Opened, Claimed and Enabled"
        MsgBox msg, vbExclamation, "Special Weigh-Tronix Command"
    End If
    
End Sub

Private Sub cmdReadSalesPrice_Click()

    Dim cSP As Currency
    
    cSP = OPOSScale1.SalesPrice
    
    lblSalesPrice.Caption = CStr(cSP)
    Call GetResultCodes

End Sub

Private Sub cmdReadTareWeight_Click()

    Dim msg As String
    
'   Dim lTW As Long
'
'   lTW = OPOSScale1.TareWeight
'
'   txtTareWeight.Text = CStr(lTW)
'   Call GetResultCodes
    
    msg = "Sorry, the current version of the Service Object does not support this feature."
    MsgBox msg, vbInformation, "Not Supported"
    
End Sub

Private Sub cmdReadUnitPrice_Click()

    Dim cUP As Currency
    
    cUP = OPOSScale1.UnitPrice
    
    If (cUP = 0) Then
        txtUnitPrice.Text = "0.00"
    Else
        txtUnitPrice.Text = CStr(cUP)
    End If
    
    Call GetResultCodes
    
End Sub

Private Sub cmdWriteTareWeight_Click()

    Dim msg As String
    
'   If (txtTareWeight.Text <> "") Then
'       OPOSScale1.TareWeight = CLng(txtTareWeight.Text)
'   Else
'       OPOSScale1.TareWeight = 0
'   End If
'
'   Call GetResultCodes
    
    msg = "Sorry, the current version of the Service Object does not support this feature."
    MsgBox msg, vbInformation, "Not Supported"
    
End Sub

Private Sub cmdWriteUnitPrice_Click()

    Dim sPrice As String
    
    sPrice = ValidateCurrencyEntry(txtUnitPrice.Text)
    txtUnitPrice.Text = sPrice
    OPOSScale1.UnitPrice = CCur(sPrice)
    
    Call GetResultCodes

End Sub

Private Sub cmdZeroScale_Click()

    Dim lret As Long
    
    lret = OPOSScale1.ZeroScale
    
    If (lret = OPOS_SUCCESS) Then
        'Clear the box that displays the weight
        lblWeight.Caption = ""
    Else
    End If
    
    Call GetResultCodes

End Sub

Private Sub chkAutoDisable_Click()

    Dim bAD As Boolean
    
    'Attempt to set/clear the property:
    If (chkAutoDisable.Value = BOX_CHECKED) Then
        OPOSScale1.AutoDisable = True
    Else
        OPOSScale1.AutoDisable = False
    End If
 
    Call GetResultCodes
    
    'Indicate an error if setting did not work:
    If (mlng_ResultCode <> OPOS_SUCCESS) Then
    End If
    
    'Now, read back and indicate the actual property from the SO:
    bAD = OPOSScale1.AutoDisable
    If (bAD = True) Then
        chkAutoDisable.Value = BOX_CHECKED
    Else
        chkAutoDisable.Value = BOX_UNCHECKED
    End If
    
End Sub

Private Sub chkDataEventEnabled_Click()

    Dim bDEE As Boolean
    
    'Attempt to set/clear the property:
    If (chkDataEventEnabled.Value = BOX_CHECKED) Then
        OPOSScale1.DataEventEnabled = True
    Else
        OPOSScale1.DataEventEnabled = False
    End If
 
    Call GetResultCodes
    
    'Indicate an error if setting did not work:
    If (mlng_ResultCode <> OPOS_SUCCESS) Then
    End If
    
    'Now, read back and indicate the actual property from the SO:
    bDEE = OPOSScale1.DataEventEnabled
    If (bDEE = True) Then
        chkDataEventEnabled.Value = BOX_CHECKED
    Else
        chkDataEventEnabled.Value = BOX_UNCHECKED
    End If
    
End Sub

Private Sub chkDeviceEnabled_Click()

    Dim bDE As Boolean
    
    'Attempt to set/clear the property:
    If (chkDeviceEnabled.Value = BOX_CHECKED) Then
        OPOSScale1.DeviceEnabled = True
    Else
        OPOSScale1.DeviceEnabled = False
    End If
 
    Call GetResultCodes
    
    'Indicate an error if setting did not work:
    If (mlng_ResultCode <> OPOS_SUCCESS) Then
    End If
    
    'Now, read back and indicate the actual property from the SO:
    bDE = OPOSScale1.DeviceEnabled
    If (bDE = True) Then
        chkDeviceEnabled.Value = BOX_CHECKED
        Call EnableTheDevice
    Else
        chkDeviceEnabled.Value = BOX_UNCHECKED
        Call DisableTheDevice
    End If

End Sub

Private Sub chkFreezeEvents_Click()

    Dim bFE As Boolean
    
    'Attempt to set/clear the property:
    If (chkFreezeEvents.Value = BOX_CHECKED) Then
        OPOSScale1.FreezeEvents = True
    Else
        OPOSScale1.FreezeEvents = False
    End If
 
    Call GetResultCodes
    
    'Indicate an error if setting did not work:
    If (mlng_ResultCode <> OPOS_SUCCESS) Then
    End If
    
    'Now, read back and indicate the actual property from the SO:
    bFE = OPOSScale1.FreezeEvents
    If (bFE = True) Then
        chkFreezeEvents.Value = BOX_CHECKED
    Else
        chkFreezeEvents.Value = BOX_UNCHECKED
    End If
    
End Sub

Private Sub cmdCheckHealth_Click()

    Dim lret As Long
    Dim msg As String
    
    If (lstCheckHealth.ListIndex = -1) Then
        msg = "Please select a test 'level' for this method."
        MsgBox msg, vbInformation, "Method parameter missing"
    Else
        'Run the CheckHealth test:
        lret = OPOSScale1.CheckHealth(lstCheckHealth.ItemData(lstCheckHealth.ListIndex))
        Call GetResultCodes
        
        'Display the CheckHealth result:
        lblCheckHealthText.Caption = OPOSScale1.CheckHealthText
    End If
    
End Sub

Private Sub cmdClaimDevice_Click()

    Dim bret As Boolean
    Dim ret As Long
    Dim msg As String
    
    If (lstClaimTimeout.ListIndex = -1) Then
        msg = "Please select a 'timeout' duration for this method."
        MsgBox msg, vbInformation, "Method parameter missing"
    Else
        'Attempt to claim the device:
        ret = OPOSScale1.ClaimDevice(lstClaimTimeout.ItemData(lstClaimTimeout.ListIndex))
        Call GetResultCodes
        
        'Now, read the Claimed status back from the control to see what it really is:
        bret = OPOSScale1.Claimed
        If (bret = True) Then
            mbln_DeviceIsClaimed = True
            lblClaimed.Caption = "TRUE"
            Call ClaimInitializations
        Else
            mbln_DeviceIsClaimed = False
            lblClaimed.Caption = "FALSE"
        End If
    
        'Update the Red/Green device status indicators:
        Call UpdateDeviceStatusIndicators
    
    End If
    
End Sub

Private Sub cmdClearInput_Click()

    Dim lret As Long
    Dim lDataCount As Long
    
    lret = OPOSScale1.ClearInput
    Call GetResultCodes
    
    'Since this operation may have an effect on queued-data, we will automatically read and refresh
    'the DataCount property for users convenience.
    lDataCount = OPOSScale1.DataCount
    lblDataCount.Caption = CStr(lDataCount)
    
End Sub

Private Sub cmdClose_Click()

    'The CloseCleanup routine will clear the result code displays.
    
    Dim lret As Long
    
    lret = OPOSScale1.Close
    Call GetResultCodes
    
    If (lret = OPOS_SUCCESS) Then
        Call CloseCleanup
    End If
    
End Sub

Private Sub cmdDirectIO_Click()

    Dim lret As Long
    
    lret = OPOSScale1.DirectIO(0, 0, "")
    Call GetResultCodes
    
End Sub

Private Sub cmdOpen_Click()
   
    Dim lOR As Long
    Dim sRC As String
    Dim lSavedResultCode As Long
    Dim devName As String
    Dim sSOD As String
    Dim lSOV As Long
    Dim ret
        
    lblOpenResult.Caption = ""                                      'clear previous open result
    devName = lstProfiles.Text
    
    lOR = OPOSScale1.Open(devName)
    If (lOR = OPOS_SUCCESS) Then
        mbln_DeviceIsOpen = True
    Else
        mbln_DeviceIsOpen = False
        mbln_DeviceIsClaimed = False
        mbln_DeviceIsEnabled = False
    End If
    
    'Read and Display the (initial) ResultCode and ResultCodeExtended:
    Call GetResultCodes
    
    'Save the initial ResultCode from the Open call:
    lSavedResultCode = mlng_ResultCode
     
    'Read and display the OpenResult:
    lOR = OPOSScale1.OpenResult
    lblOpenResult.Caption = COpenResultStringStr(lOR)
    
    Call UpdateDeviceStatusIndicators

    If (lOR = OPOS_SUCCESS) Then
        'Exercise all properties and methods:
        Call Version10
        Call Version12
        Call Version13
        Call Version15

        mlng_ResultCode = lSavedResultCode
        sRC = CResultCodeStr(lSavedResultCode)
        lblResultCode.Caption = sRC
        sbrStatus(COMMON_PANEL).Panels.Item(RC_STATUS).Text = "RC: " & sRC
        sbrStatus(SPECIFIC_PANEL).Panels.Item(RC_STATUS).Text = "RC: " & sRC
        sbrStatus(ADVANCED_PANEL).Panels.Item(RC_STATUS).Text = "RC: " & sRC
    End If

    'Read the current Service Object version and description from the control and write it
    'to the profile in the registry as a diagnostic tool.
    'ServiceObjectDescription -
    sSOD = OPOSScale1.ServiceObjectDescription
    ret = SetOPOSRegValue(devClass, devName, "ServiceObjectDescription", sSOD, "")
    
    'ServiceObjectVersion -
    lSOV = OPOSScale1.ServiceObjectVersion
    ret = SetOPOSRegValue(devClass, devName, "ServiceObjectVersion", CStr(lSOV), "")
        
End Sub

Private Sub cmdReadWeight_Click()

    Dim lWeight     As Long
    Dim lTimeout    As Long
    Dim lret        As Long
    Dim sWeight     As String
    Dim msg      As String
       
    If (lstReadWeightTimeout.ListIndex = -1) Then
        msg = "Please select a 'timeout' duration for this method."
        MsgBox msg, vbInformation, "Method parameter missing"
    Else
        cmdReadWeight.Enabled = False
        
        'Determines the number of milliseconds to wait for a settled weight.
        lTimeout = lstReadWeightTimeout.ItemData(lstReadWeightTimeout.ListIndex)
        
        If ((mbln_DeviceIsOpen = True) And (mbln_DeviceIsClaimed = True) And (mbln_DeviceIsEnabled = True)) Then
            If (OPOSScale1.AsyncMode = False) Then
                'Do a synchronous reading of the current weight from the scale:
                lret = OPOSScale1.ReadWeight(lWeight, lTimeout)
                If (lret = OPOS_SUCCESS) Then
                    lblWeight.Caption = Format$(lWeight, "000")
                    mlng_Weight = lWeight
                Else
                    lblWeight.Caption = ""
                    mlng_Weight = 0
''''' BOBBY
'''''                    msg = "Error trying to read weight." & Chr(13)
'''''                    msg = msg & "Could not aquire a stable, non-zero weight." & Chr(13)
'''''                    msg = msg & "Weight may be at zero, behind zero, overcapacity or not-stable." & Chr(13)
'''''                    msg = msg & "Otherwise, please check the Configuration parameters and the Timeout parameter."
'''''                    MsgBox msg
                End If
            Else
                'Do an asynchronous reading of the current weight from the scale:
                'Put values in module variables.
                lret = OPOSScale1.ReadWeight(0, lTimeout)
                Beep
            End If
        Else
            lblWeight.Caption = ""
            mlng_Weight = 0
            
            msg = "Error trying to read weight." & Chr(13)
            msg = msg & "The device must be 'Opened', 'Claimed' and 'Enabled' in order to access the weight."
            MsgBox msg
        End If
    End If
    
    cmdReadWeight.Enabled = True
    Call GetResultCodes

End Sub

Private Sub cmdRefreshDataCount_Click()

    Dim lDataCount As Long
    
    'Read and Display the (refreshed) DataCount:
    lDataCount = OPOSScale1.DataCount
    lblDataCount.Caption = CStr(lDataCount)
    Call GetResultCodes
    
End Sub

Private Sub cmdRefreshState_Click()

    Call UpdateStateStatus
    Call GetResultCodes
    
End Sub

Private Sub cmdReleaseDevice_Click()

    Dim bret As Boolean
    Dim lret As Long
    
    'Attempt to release the claim on the device (ie scale).
    lret = OPOSScale1.ReleaseDevice
    Call GetResultCodes
    
    'Now, read the Claimed status back from the control to see what it really is:
    bret = OPOSScale1.Claimed
    If (bret = True) Then
        mbln_DeviceIsClaimed = True
        lblClaimed.Caption = "TRUE"
    Else
        mbln_DeviceIsClaimed = False
        lblClaimed.Caption = "FALSE"
    End If

    'Update the Red/Green device status indicators:
    Call UpdateDeviceStatusIndicators

End Sub

Private Sub cmdScaleTestSend_Click()

    Dim scale_response As String
    Dim scale_settings As String
    Dim port As Integer
    Dim baud, databits, parity As String
    Dim command As String
    Dim msg As String
    Const ENQ = &H5
    
    
    If (lstScaleTestSerialPort.ListIndex >= 0) Then
        If (lstScaleTestBaudRate.ListIndex >= 0) Then
            If (lstScaleTestDataBits.ListIndex >= 0) Then
                If (lstScaleTestParity.ListIndex >= 0) Then
                    If (lstScaleTestScaleFunction.ListIndex >= 0) Then
                        
                        'Compute communication control settings:
                        port = lstScaleTestSerialPort.ListIndex + 1
                                
                        Select Case (lstScaleTestBaudRate.ListIndex)
                            Case 0: baud = "1200"
                            Case 1: baud = "2400"
                            Case 2: baud = "4800"
                            Case 3: baud = "9600"
                            Case 4: baud = "19200"
                        End Select
                        
                        Select Case (lstScaleTestDataBits.ListIndex)
                            Case 0: databits = "7"
                            Case 1: databits = "8"
                        End Select
                        
                        Select Case (lstScaleTestParity.ListIndex)
                            Case 0: parity = "n"
                            Case 1: parity = "o"
                            Case 2: parity = "e"
                        End Select
                        
                        Select Case (lstScaleTestScaleFunction.ListIndex)
                            Case 0: command = "W"
                            Case 1: command = "S"
                            Case 2: command = "Z"
                            Case 3: command = "u"
                            Case 4: command = "A"
                            Case 5: command = "m"
                            Case 6: command = "C"
                            Case 7: command = "P1.23"
                            Case 8: command = "p"
                            Case 9: command = "s"
                            Case 10: command = "X"
                            Case 11: command = Chr$(ENQ)
                            Case 12: command = "q"
                        End Select
                        
                        MSComm1.Settings = baud & "," & parity & "," & databits & "," & "1"
                        
                        If (mbln_DeviceIsClaimed = True) Then
                            lblScaleTestScaleResponse = ""
                            
                            msg = "Cannot acces the serial port because it is currently in use by the Service Object." & Chr$(10)
                            msg = msg & "To run this scale test, you must first click on the 'ReleaseDevice' button " & Chr$(10)
                            msg = msg & "on the Common tab panel to make the port available."
                            MsgBox msg
                        Else
                            If (WT_OpenSerialPort(port) = True) Then
                                lblScaleTestScaleResponse.Caption = ""
                                scale_response = WT_ScaleCommand(command)
                                lblScaleTestScaleResponse.Caption = WT_ExpandAscStr(scale_response)
                            End If
                            
                            If (WT_CloseSerialPort(port) = True) Then
                            End If
                        End If
                    Else
                        MsgBox "Please select a 'scale function' first."
                    End If
                Else
                    MsgBox "Please select a 'parity' first."
                End If
            Else
                MsgBox "Please select 'data bits' first."
            End If
        Else
            MsgBox "Please select a 'baud rate' first."
        End If
    Else
        MsgBox "Please select a 'serial port' first."
    End If

End Sub

Private Sub Form_Load()

    'We need to show the form before it is finished loading in order to be
    'able to set the focus to one of the the form's controls.
    Set OPOSScale1 = New OPOSScale
    
    Me.Show

    devClass = "Scale"
    
    'Compute the full Administration Program version:
    mlng_AdminMajorVersion = App.Major * 1000000
    mlng_AdminMinorVersion = App.Minor * 1000
    mlng_AdminBuildVersion = App.Revision
    mlng_AdminVersion = mlng_AdminMajorVersion + mlng_AdminMinorVersion + mlng_AdminBuildVersion
 
    'See the Main.Bas file for desc of these globals
    'maxInstance = 0        ' Start off with no instances loaded
    curInstance = 0         ' No current scale device on Scale Configuration tab
    sizInstances = 100      ' Allocate space for 100 maximum devices
    
    ReDim Preserve arrInstances(sizInstances)
  
    mbln_DeviceIsOpen = False
    mbln_DeviceIsClaimed = False
    mbln_DeviceIsEnabled = False
    Call UpdateDeviceStatusIndicators
    
    'Update the device instance displayed on the 'Scale Profile' tab
    Call RefreshDeviceNames
    
    If (lstProfiles.ListCount < 1) Then
        'Set the focus to the button that lets the user add a scale
        btnAdd.SetFocus
    Else
        'Set the focus to the drop-down box containing the list of scales
        lstProfiles.SetFocus
    End If
    
    'Turn on controls to let user add a device regardless of whether the list of devices contains
    'any items.
    EnableAddControls True
    
    'Leave all other controls disabled until the device is enabled.
    EnableConfigAndRemoveControls False
    
    'Resize the form:
    winMainHeight = Me.Height
    winMainWidth = Me.Width
        
    'Initialize some list boxes:
    lstScaleTestSerialPort.ListIndex = -1
    lstScaleTestBaudRate.ListIndex = -1
    lstScaleTestDataBits.ListIndex = -1
    lstScaleTestParity.ListIndex = -1
    
    lstClaimTimeout.ListIndex = -1
    lstBinaryConversion.ListIndex = -1
    lstPowerNotify.ListIndex = -1
    lstReadWeightTimeout.ListIndex = 0
    
    'Set initial startup tab to "Scale Profile":
    SSTab1.Tab = 0
    
    'Make sure the status bars are the same:
    sbrStatus(1).Height = sbrStatus(0).Height
    sbrStatus(1).Width = sbrStatus(0).Width
    sbrStatus(1).Top = sbrStatus(0).Top
    sbrStatus(1).Left = sbrStatus(0).Left
    
    sbrStatus(2).Height = sbrStatus(0).Height
    sbrStatus(2).Width = sbrStatus(0).Width
    sbrStatus(2).Top = sbrStatus(0).Top
    sbrStatus(2).Left = sbrStatus(0).Left
    
    'Status bar bug? Bar on 'Specific' tab doesn't always show up!!
    sbrStatus(2).Visible = True
    sbrStatus(2).Visible = False
    
    Call lstProfiles_Click
    
    'Read and display the State, ControlObjectVersion, ControlObjectDescription:
    Call Version10Always
    
End Sub

Private Sub Form_Unload(Cancel As Integer)

    Set OPOSScale1 = Nothing

End Sub

Private Sub lblCapPowerReporting_Click()

    ' This routine was used during development to verify that Service Object reacts properly if an
    ' attempt is made to acces the read-only property before Open.

    Dim lCPR As Long
    
    lCPR = OPOSScale1.CapPowerReporting
    lblCapPowerReporting.Caption = CCapPowerReportingStr(lCPR)
    Call GetResultCodes

End Sub

Private Sub lblCheckHealthText_Click()

    ' This routine was used during development to verify that Service Object reacts properly if an
    ' attempt is made to acces the read-only property before Open.
    
    Dim sCHT As String
    
    sCHT = OPOSScale1.CheckHealthText
    lblCheckHealthText.Caption = sCHT
    Call GetResultCodes

End Sub

Private Sub lblClaimed_Click()
    
    ' This routine was used during development to verify that Service Object reacts properly if an
    ' attempt is made to acces the read-only property before Open.

    Dim bClaimed As Boolean
    
    bClaimed = OPOSScale1.Claimed
    
    If (bClaimed = True) Then
        lblClaimed.Caption = "TRUE"
    Else
        lblClaimed.Caption = "FALSE"
    End If

    Call GetResultCodes
    
End Sub

Private Sub lblDataCount_Click()

    ' This routine was used during development to verify that Service Object reacts properly if an
    ' attempt is made to acces the read-only property before Open.

    Dim lDataCount As Long
    
    lDataCount = OPOSScale1.DataCount
    lblDataCount.Caption = CStr(lDataCount)
    Call GetResultCodes
    
End Sub

Private Sub lblDeviceDescription_Click()

    ' This routine was used during development to verify that Service Object reacts properly if an
    ' attempt is made to acces the read-only property before Open.

    Dim sDD As String
    
    sDD = OPOSScale1.DeviceDescription
    lblDeviceDescription.Caption = sDD
    Call GetResultCodes

End Sub

Private Sub lblDeviceName_Click()

    ' This routine was used during development to verify that Service Object reacts properly if an
    ' attempt is made to acces the read-only property before Open.

    Dim sDN As String
    
    sDN = OPOSScale1.DeviceName
    lblDeviceName.Caption = sDN
    Call GetResultCodes

End Sub

Private Sub lblMaxDisplayTextChars_Click()

    ' This routine was used during development to verify that Service Object reacts properly if an
    ' attempt is made to acces the read-only property before Open.

    Dim lMDTC As Long
    
    lMDTC = OPOSScale1.MaxDisplayTextChars
    lblMaxDisplayTextChars.Caption = CStr(lMDTC)
    Call GetResultCodes

End Sub

Private Sub lblMaximumWeight_Click()

    ' This routine was used during development to verify that Service Object reacts properly if an
    ' attempt is made to acces the read-only property before Open.

    Dim lMW As Long
    
    lMW = OPOSScale1.MaximumWeight
    lblMaximumWeight.Caption = CStr(lMW)
    Call GetResultCodes

End Sub

Private Sub lblOpenResult_Click()

    ' This routine was used during development to verify that Service Object reacts properly if an
    ' attempt is made to acces the read-only property before Open.

    Dim lOR As Long
    
    lOR = OPOSScale1.OpenResult
    lblOpenResult.Caption = COpenResultStringStr(lOR)
    Call GetResultCodes
    
End Sub

Private Sub lblPowerState_Click()

    ' This routine was used during development to verify that Service Object reacts properly if an
    ' attempt is made to acces the read-only property before Open.
    
    Dim lPS As Long
    
    lPS = OPOSScale1.PowerState
    lblPowerState.Caption = CPowerStateStr(lPS)
    Call GetResultCodes

End Sub

Private Sub lblResultCode_Click()

    ' This routine was used during development to verify that Service Object reacts properly if an
    ' attempt is made to acces the read-only property before Open.

    Dim lRC As Long
    Dim sRC As String
    
    lRC = OPOSScale1.ResultCode                                  'get the result code
    sRC = CResultCodeStr(lRC)
    lblResultCode.Caption = CResultCodeStr(sRC)                  'property status
        
    sbrStatus(COMMON_PANEL).Panels.Item(RC_STATUS).Text = "RC: " & sRC
    sbrStatus(SPECIFIC_PANEL).Panels.Item(RC_STATUS).Text = "RC: " & sRC
    sbrStatus(ADVANCED_PANEL).Panels.Item(RC_STATUS).Text = "RC: " & sRC
    
End Sub

Private Sub lblResultCodeExtended_Click()

    ' This routine was used during development to verify that Service Object reacts properly if an
    ' attempt is made to acces the read-only property before Open.

    Dim lRCE As Long
    Dim sRCE As String
    
    lRCE = OPOSScale1.ResultCodeExtended
        
    Select Case (mlng_ResultCodeExtended)
    
        Case OPOS_ESCAL_OVERWEIGHT:
            sRCE = "OPOS_ESCAL_OVERWEIGHT"
            lblResultCodeExtended.Caption = sRCE
            sbrStatus(COMMON_PANEL).Panels.Item(RCE_STATUS).Text = "RCE: " & sRCE
            sbrStatus(SPECIFIC_PANEL).Panels.Item(RCE_STATUS).Text = "RCE: " & sRCE
            sbrStatus(ADVANCED_PANEL).Panels.Item(RCE_STATUS).Text = "RCE: " & sRCE
            
        Case Else:
            sRCE = CStr(mlng_ResultCodeExtended)
            lblResultCodeExtended.Caption = sRCE
            sbrStatus(COMMON_PANEL).Panels.Item(RCE_STATUS).Text = "RCE: " & sRCE
            sbrStatus(SPECIFIC_PANEL).Panels.Item(RCE_STATUS).Text = "RCE: " & sRCE
            sbrStatus(ADVANCED_PANEL).Panels.Item(RCE_STATUS).Text = "RCE: " & sRCE

    End Select

End Sub

Private Sub lblSalesPrice_Click()

    ' This routine was used during development to verify that Service Object reacts properly if an
    ' attempt is made to acces the read-only property before Open.

    Dim cSP As Currency
    
    cSP = OPOSScale1.SalesPrice
    lblSalesPrice.Caption = CStr(cSP)
    Call GetResultCodes

End Sub


Private Sub lblServiceObjectDescription_Click()

    ' This routine was used during development to verify that Service Object reacts properly if an
    ' attempt is made to acces the read-only property before Open.
    
    Dim sSOD As String
    
    sSOD = OPOSScale1.ServiceObjectDescription
    lblServiceObjectDescription.Caption = sSOD
    Call GetResultCodes

End Sub

Private Sub lblServiceObjectVersion_Click()

    ' This routine was used during development to verify that Service Object reacts properly if an
    ' attempt is made to acces the read-only property before Open.
    
    Dim lSOV As Long
    
    lSOV = OPOSScale1.ServiceObjectVersion
    lblServiceObjectVersion.Caption = CStr(lSOV)
    Call GetResultCodes
    
End Sub

Private Sub lblState_Click()

    ' This routine was used during development to verify that Service Object reacts properly if an
    ' attempt is made to acces the read-only property before Open.

    Call UpdateStateStatus
    Call GetResultCodes
    
End Sub

Private Sub lblWeightUnit_Click()

    ' This routine was used during development to verify that Service Object reacts properly if an
    ' attempt is made to acces the read-only property before Open.

    Dim lWU As Long
    
    If (mbln_DeviceIsOpen = False) Then
        lWU = OPOSScale1.WeightUnit
        lblWeightUnit.Caption = CStr(lWU)
        Call GetResultCodes
    End If
    
End Sub

Private Sub lstBinaryConversion_Click()
   
    'Attempt to set the BinaryConversion property in the ServiceObject:
    If (lstBinaryConversion.ListIndex >= 0) Then
        OPOSScale1.BinaryConversion = lstBinaryConversion.ItemData(lstBinaryConversion.ListIndex)
            
        'Get the result of the attempt:
        Call GetResultCodes
            
        If (mlng_ResultCode <> OPOS_SUCCESS) Then
            lstBinaryConversion.ListIndex = -1
        End If
    Else
    End If

End Sub

Private Sub lstDataBits_Click()

    Dim i As Integer
    Dim ret As Long
    Dim devName As String
    Dim szValue As String
    Dim curDataBits As Integer
    
    'Set the databits for the scale
    devName = lstProfiles.Text
    szValue = lstDataBits.Text
    
    'Search internal collection of data bits and set
    'the global index for the currently selected one
    If (devName = "") Then
        lstDataBits.ListIndex = 0
    Else
        i = 1
        curDataBits = 0
        
        'Determine the index for the current databits , based on its name
        While i <= lstDataBits.ListCount And curDataBits = 0
            If (UCase(arrInstances(i).szDevName) = UCase(devName)) Then
                curDataBits = i
            End If
            i = i + 1
        Wend
        
        ret = SetOPOSRegValue(devClass, devName, "DataBits", szValue, "")
    End If
End Sub

Private Sub lstInitialWeightUnits_Click()

    Dim i As Integer
    Dim ret As Long
    Dim devName As String
    Dim szValue As String
    Dim curUoM As Integer
    
    'Set the UoM for the scale
    devName = lstProfiles.Text
    szValue = lstInitialWeightUnits.Text
    
    If (devName = "") Then
        lstInitialWeightUnits.ListIndex = 0
    Else
        i = 1
        curUoM = 0
        'Determine the index for the current u-o-m, based on its value
        While i <= lstInitialWeightUnits.ListCount And curUoM = 0
            If ((arrInstances(i).szDevName) = devName) Then
                curUoM = i
            End If
            i = i + 1
        Wend
        ret = SetOPOSRegValue(devClass, devName, "Initial_WeightUnits", szValue, "")
    End If
    
End Sub

Private Sub lstPowerNotify_Click()

    'Attempt to set the PowerNotify property in the ServiceObject:
    If (lstPowerNotify.ListIndex >= 0) Then
        OPOSScale1.PowerNotify = lstPowerNotify.ItemData(lstPowerNotify.ListIndex)
        
        'Get the result of the attempt:
        Call GetResultCodes
            
        If (mlng_ResultCode <> OPOS_SUCCESS) Then
            lstPowerNotify.ListIndex = -1
        End If
    Else
    End If
    
End Sub





Private Sub mnuFileExit_Click()

    Unload Me
    
End Sub

Private Sub lstProfiles_Click()
   
    Dim devName As String
    Dim sval As String
    
    
    devName = lstProfiles.Text
    
    ' Search internal collection of scales and set the global index for the currently selected one.
    SelectDevice devName
   
    ' Get the serial port for the selected device instance from the registry
    winMain.lstSerialPort.ListIndex = VerifySerialPort(GetSerialPort(devName))

    ' Get the baud rate for the selected device instance from the registry
    winMain.lstBaudRate.ListIndex = VerifyBaudRate(GetBaudRate(devName))
    
    ' Get the data bits for the selected device instance from the registry
    winMain.lstDataBits.ListIndex = VerifyDataBits(GetDataBits(devName))
    
    ' Get the parity for the selected device instance from the registry
    winMain.lstParity.ListIndex = VerifyParity(GetParity(devName))
    
    
    ' Get the initial scale property values that are in effect after Open but which may be overriden
    ' after Open, Claim and Enable if the scale supports accessing these values:
    
    ' Get the initial "MaximumWeight" attribute for the selected device from the registry
    winMain.txtInitialMaximumWeight.Text = GetInitialMaximumWeight(devName)
    
    ' Get the initial "WeightUnits" for the selected device instance from the registry
    winMain.lstInitialWeightUnits.ListIndex = VerifyInitialWeightUnits(GetInitialWeightUnits(devName))
    
    ' Get the initial "CapDisplay" for the selected device instance from the registry
    winMain.chkInitialCapDisplay.Value = ConvertYesNo(GetInitialCapDisplay(devName))
    
    ' Get the initial "CapDisplayText" for the selected device instance from the registry
    winMain.chkInitialCapDisplayText.Value = ConvertYesNo(GetInitialCapDisplayText(devName))
    
    ' Get the initial "CapPriceCalculating" for the selected device instance from the registry
    winMain.chkInitialCapPriceCalculating.Value = ConvertYesNo(GetInitialCapPriceCalculating(devName))
    
    ' Get the initial "CapTareWeight" for the selected device instance from the registry
    winMain.chkInitialCapTareWeight.Value = ConvertYesNo(GetInitialCapTareWeight(devName))
    
    ' Get the initial "CapZeroScale" for the selected device instance from the registry
    winMain.chkInitialCapZeroScale.Value = ConvertYesNo(GetInitialCapZeroScale(devName))
            
    ' Get the initial "MaxDisplayTextChars" attribute for the selected device from the registry
    winMain.txtInitialMaxDisplayTextChars.Text = GetInitialMaxDisplayTextChars(devName)
            
    ' Get the log file name for the selected device instance from the registry
    winMain.lblLogFile.Caption = GetLogFileName(devName)
    
    ' Get the log file verbosity for the selected device instance from the registry
    'winMain.lstVerbosity.ListIndex = VerifyVerbosity(GetVerbosity(devName))
    
    
    ' Fill in the "Details" section on the "Scale Profile" page:
    ' ---------------------------------------------------------
    ' Get the (Default) i.e. the ProgID string
    winMain.lblProgID.Caption = GetProgID(devName)
    
    ' Get the Description string
    winMain.lblDescription.Caption = GetDescription(devName)
    
    ' Get the Administration Program Version
    winMain.lblAdminVersion.Caption = GetAdminVersion(devName)
    
    ' Get the Service Object name string
    winMain.lblService.Caption = GetServiceObject(devName)
    
    ' Get the Service Object version string
    winMain.lblServiceVer.Caption = GetServiceObjectVersion(devName)
    
    ' Get the Service Object description string
    winMain.lblServiceDesc.Caption = GetServiceObjectDescription(devName)
    
    ' Get the Model Number string
    winMain.lblModel.Caption = GetModel(devName)
    
    
    'Enable/Disable controls as appropriate
    If (Len(devName) = 0) Then
        'Disable all controls on the Scale Configuration tab except the Add button
        EnableAddControls True
        EnableConfigAndRemoveControls False
    Else
        'Enable all controls on the Scale Configuration tab except the DisableDevice button
        EnableAddRemoveControls True
        EnableConfigAndRemoveControls True
    End If

End Sub

Private Sub lstSerialPort_Click()

    Dim i As Integer
    Dim ret As Long
    Dim devName As String
    Dim szValue As String
    Dim curSerialPort As Integer
    
    'Set the COM port for the scale:
    devName = lstProfiles.Text
    szValue = lstSerialPort.Text
    
    'Search internal collection of COM Ports and set the global index for the currently selected one.
    If (devName = "") Then
        lstSerialPort.ListIndex = 0
    Else
        i = 1
        curSerialPort = 0
        
        'Determine the index for the current COM Port, based on its name:
        While i <= lstSerialPort.ListCount And curSerialPort = 0
            If (UCase(arrInstances(i).szDevName) = UCase(devName)) Then
                curSerialPort = i
            End If
            i = i + 1
        Wend
        
        ret = SetOPOSRegValue(devClass, devName, "SerialPort", szValue, "")
    End If
    
End Sub

Private Sub lstBaudRate_Click()

    Dim i As Integer
    Dim ret As Long
    Dim devName As String
    Dim szValue As String
    Dim curBaudRate As Integer
    
    'Set the baud rate for the scale
    devName = lstProfiles.Text
    szValue = lstBaudRate.Text
    
    'Search internal collection of baud rates and set
    'the global index for the currently selected one
    If (devName = "") Then
        lstBaudRate.ListIndex = 0
    Else
        i = 1
        curBaudRate = 0
        
        'Determine the index for the current baud rate, based on its value
        While i <= lstBaudRate.ListCount And curBaudRate = 0
            If (UCase(arrInstances(i).szDevName) = UCase(devName)) Then
                curBaudRate = i
            End If
            i = i + 1
        Wend
        
        ret = SetOPOSRegValue(devClass, devName, "BaudRate", szValue, "")
    End If
End Sub

Private Sub lstParity_Click()

    Dim i As Integer
    Dim ret As Long
    Dim devName As String
    Dim szValue As String
    Dim curParity As Integer
    
    'Set the parity for the scale
    devName = lstProfiles.Text
    szValue = lstParity.Text
    
    If (szValue = "None") Then
        szValue = "Space"
    End If
    
    If (devName = "") Then
        lstParity.ListIndex = 0
    Else
        i = 1
        curParity = 0
        
        'Determine the index for the current parity, based on its value
        While i <= lstParity.ListCount And curParity = 0
            If (UCase(arrInstances(i).szDevName) = UCase(devName)) Then
                curParity = i
            End If
            i = i + 1
        Wend
        
        ret = SetOPOSRegValue(devClass, devName, "Parity", szValue, "")
    End If

End Sub

Private Sub RefreshDeviceNames()
    
    ' Refresh the drop down boxes with values from the registry for the Device Instance on the
    ' Scale Profile tab.
    
    lstProfiles.Clear
    LoadListBox "lstProfiles", devClass
    
End Sub

Private Sub mnuHelpAbout_Click()

    winAbout.Show
    
End Sub

Private Function CResultCodeStr(ByVal lResultCode As Long) As String

    Select Case (lResultCode)
    
    Case OPOS_SUCCESS:
        CResultCodeStr = "OPOS_SUCCESS"
        
    Case OPOS_E_CLOSED:
        CResultCodeStr = "OPOS_E_CLOSED"
    
    Case OPOS_E_CLAIMED:
        CResultCodeStr = "OPOS_E_CLAIMED"
    
    Case OPOS_E_NOTCLAIMED:
        CResultCodeStr = "OPOS_E_NOTCLAIMED"
    
    Case OPOS_E_NOSERVICE:
        CResultCodeStr = "OPOS_E_NOSERVICE"
    
    Case OPOS_E_DISABLED:
        CResultCodeStr = "OPOS_E_DISABLED"
    
    Case OPOS_E_ILLEGAL:
        CResultCodeStr = "OPOS_E_ILLEGAL"
    
    Case OPOS_E_NOHARDWARE:
        CResultCodeStr = "OPOS_E_NOHARDWARE"
    
    Case OPOS_E_OFFLINE:
        CResultCodeStr = "OPOS_E_OFFLINE"
    
    Case OPOS_E_NOEXIST:
        CResultCodeStr = "OPOS_E_NOEXIST"
    
    Case OPOS_E_EXISTS:
        CResultCodeStr = "OPOS_E_EXISTS"
    
    Case OPOS_E_FAILURE:
        CResultCodeStr = "OPOS_E_FAILURE"
    
    Case OPOS_E_TIMEOUT:
        CResultCodeStr = "OPOS_E_TIMEOUT"
    
    Case OPOS_E_BUSY:
        CResultCodeStr = "OPOS_E_BUSY"
    
    Case OPOS_E_EXTENDED:
        CResultCodeStr = "OPOS_E_EXTENDED"
    
    Case Else
        CResultCodeStr = CStr(lResultCode)
    
    End Select
    
End Function

Private Function COpenResultStringStr(ByVal lOpenResultCode As Long) As String

    Dim sret As String
   
    Select Case (lOpenResultCode)
    
          Case OPOS_SUCCESS:
              sret = "OPOS_SUCCESS"
          
          Case OPOS_OR_ALREADYOPEN:
              sret = "OPOS_OR_ALREADYOPEN"
          
          Case OPOS_OR_REGBADNAME:
              sret = "OPOS_OR_REGBADNAME"
          
          Case OPOS_OR_REGPROGID:
              sret = "OPOS_OR_REGPROGID"
          
          Case OPOS_OR_CREATE:
              sret = "OPOS_OR_CREATE"
          
          Case OPOS_OR_BADIF:
              sret = "OPOS_OR_BADIF"
          
          Case OPOS_OR_FAILEDOPEN:
              sret = "OPOS_OR_FAILEDOPEN"
          
          Case OPOS_OR_BADVERSION:
              sret = "OPOS_OR_BADVERSION"
          
          Case OPOS_ORS_NOPORT:
              sret = "OPOS_ORS_NOPORT"
          
          Case OPOS_ORS_NOTSUPPORTED:
              sret = "OPOS_ORS_NOTSUPPORTED"
          
          Case OPOS_ORS_CONFIG:
              sret = "OPOS_ORS_CONFIG"
          
          Case OPOS_ORS_SPECIFIC:
              sret = "OPOS_ORS_SPECIFIC"
          
          Case Else:
              sret = CStr(lOpenResultCode)
      
      End Select
                                            
    COpenResultStringStr = sret
    
End Function

Private Sub mnuRefreshDeviceNames_Click()

    Call RefreshDeviceNames
    
End Sub

Private Sub OPOSScale1_DataEvent(ByVal lWeight As Long)

    'Notes:
    ' 1)Before the SO fires the SOData (event) to the CO, it first sets the DataEventEnabled property
    '   to FALSE to prevent any further data events from being generated until the application sets this
    '   property back to TRUE.
    '   When we get this DataEvent, we will read the property setting back from the SO and update the
    '   checkbox setting on the 'Common' tab of the test panel otherwise it will always look 'checked'
    '   even though the SO has disabled the actual property.
    
    Dim bDEE As Boolean
    Dim bDE As Boolean
    
    lblWeight.Caption = Format$(lWeight, "000")
    mlng_Weight = lWeight
    cmdReadWeight.Enabled = True

    'Now, read back and indicate the actual property from the SO.
    'Reason is that it's state may have changed as a result of the reading of data.
    bDEE = OPOSScale1.DataEventEnabled
    If (bDEE = True) Then
        chkDataEventEnabled.Value = BOX_CHECKED
    Else
        chkDataEventEnabled.Value = BOX_UNCHECKED
    End If
    
    'Now, read back and indicate the actual property from the SO.
    'Reason is that it's state may have changed as a result of the reading of data.
    bDE = OPOSScale1.DeviceEnabled
    If (bDE = True) Then
        chkDeviceEnabled.Value = BOX_CHECKED
        Call EnableTheDevice
    Else
        chkDeviceEnabled.Value = BOX_UNCHECKED
        Call DisableTheDevice
    End If
    
End Sub

Private Sub OPOSScale1_ErrorEvent(ByVal ResultCode As Long, ByVal ResultCodeExtended As Long, ByVal ErrorLocus As Long, ByRef pErrorResponse As Long)

    ' Due to the hardware and interface nature of our scale/SO combination, an error event can only occur
    ' due to a problem during asynchronous reading of weight.
    ' Therefore, the ErrorLocus will always be OPOS_EL_INPUT and the possible client responses would be
    ' to set pErrorResponse to OPOS_ER_RETRY or OPOS_ER_CLEAR. The OPOS specification defines the default
    ' value of pErrorResponse to be OPOS_ER_CLEAR for an ErrorLocus of OPOS_EL_INPUT and does not require
    ' that "RETRY" be supported. Therefore when this error handler ends, the SO will clear and not attempt
    ' another read.
    
    Dim msg As String
    Dim button As Long
    Dim bDEE As Boolean
    Dim bDE As Boolean
        
    msg = "An error occured while attempting to read weight asynchronously from the scale." & Chr(ASCII_LF)
    msg = msg & "The scale service object does not support 'retry'. The error state will " & Chr(ASCII_LF)
    msg = msg & "now be exited."
    
    Call GetResultCodes
    Beep
    
    button = MsgBox(msg, (vbOKOnly + vbExclamation + vbApplicationModal), "Scale Communication Error")
    
    pErrorResponse = OPOS_ER_CLEAR
    lblWeight.Caption = ""
    cmdReadWeight.Enabled = True
    
    'Now, read back and indicate the actual property from the SO.
    'Reason is that it's state may have changed as a result of the reading of data.
    bDEE = OPOSScale1.DataEventEnabled
    If (bDEE = True) Then
        chkDataEventEnabled.Value = BOX_CHECKED
    Else
        chkDataEventEnabled.Value = BOX_UNCHECKED
    End If
    
    'Now, read back and indicate the actual property from the SO.
    'Reason is that it's state may have changed as a result of the reading of data.
    bDE = OPOSScale1.DeviceEnabled
    If (bDE = True) Then
        chkDeviceEnabled.Value = BOX_CHECKED
        Call EnableTheDevice
    Else
        chkDeviceEnabled.Value = BOX_UNCHECKED
        Call DisableTheDevice
    End If
  
End Sub


Private Sub timCommTimeout_Timer()

    ' This is the scale communications watchdog timer for the scale test panel.
    ' If this event fires, it means that the scale has not responded to the most
    ' recent command.
    
    Dim msg As String
    
    
    timCommTimeout.Enabled = False          'prevent further timer events
    bWaiting = False                        'allow escape from "receive" routine
    
    ' Close comm port, put up error message
    ' Error, timed out:
    msg = "Sorry, scale timeout occured on COM port"
    
End Sub

Private Sub GetResultCodes()

    Dim sRC As String
    Dim sRCE As String
    
    mlng_ResultCode = OPOSScale1.ResultCode
    sRC = CResultCodeStr(mlng_ResultCode)
    lblResultCode.Caption = sRC
    sbrStatus(COMMON_PANEL).Panels.Item(RC_STATUS).Text = "RC: " & sRC
    sbrStatus(SPECIFIC_PANEL).Panels.Item(RC_STATUS).Text = "RC: " & sRC
    sbrStatus(ADVANCED_PANEL).Panels.Item(RC_STATUS).Text = "RC: " & sRC
    
    If (mlng_ResultCode = OPOS_E_EXTENDED) Then                     'check ResultCode
        'OPOS Class-specific value has been set.
        'Get it and display string equivalent.
        mlng_ResultCodeExtended = OPOSScale1.ResultCodeExtended
        sRCE = COPOSResultCodeExtStr(mlng_ResultCodeExtended)
    Else
        'Manufacturer SO-specific value might be set.
        mlng_ResultCodeExtended = OPOSScale1.ResultCodeExtended
        sRCE = CWTResultCodeExtStr(mlng_ResultCodeExtended)
    End If

    lblResultCodeExtended.Caption = sRCE
    sbrStatus(COMMON_PANEL).Panels.Item(RCE_STATUS).Text = "RCE: " & sRCE
    sbrStatus(SPECIFIC_PANEL).Panels.Item(RCE_STATUS).Text = "RCE: " & sRCE
    sbrStatus(ADVANCED_PANEL).Panels.Item(RCE_STATUS).Text = "RCE: " & sRCE
    
End Sub

Private Sub GetMfgResultCodes()
    
    'This is essentially the same as GetResultCodes() except this one displays ResultCodeExtended
    'on the status bars based on the vendor (i.e. Weigh-Tronix) specific function just performed.
    'The ResultCode is standard (i.e. not vendor-specific).
    'One final difference; when doing vendor-specific commands the RCE should never be returned as
    'OPOS_E_EXTENDED, therefore this routine does not conditionally check for it as the standard
    'GetResultCodes() routine does.
    
    Dim sRC As String
    Dim sRCE As String
    
    mlng_ResultCode = OPOSScale1.ResultCode
    sRC = CResultCodeStr(mlng_ResultCode)
    lblResultCode.Caption = sRC
    sbrStatus(COMMON_PANEL).Panels.Item(RC_STATUS).Text = "RC: " & sRC
    sbrStatus(SPECIFIC_PANEL).Panels.Item(RC_STATUS).Text = "RC: " & sRC
    sbrStatus(ADVANCED_PANEL).Panels.Item(RC_STATUS).Text = "RC: " & sRC
    
    'Manufacturer SO-specific value might be set.
    mlng_ResultCodeExtended = OPOSScale1.ResultCodeExtended
    sRCE = CWTMfgResultCodeExtStr(mlng_ResultCodeExtended)

    lblResultCodeExtended.Caption = sRCE
    sbrStatus(COMMON_PANEL).Panels.Item(RCE_STATUS).Text = "RCE: " & sRCE
    sbrStatus(SPECIFIC_PANEL).Panels.Item(RCE_STATUS).Text = "RCE: " & sRCE
    sbrStatus(ADVANCED_PANEL).Panels.Item(RCE_STATUS).Text = "RCE: " & sRCE
    
End Sub

Private Sub UpdateStateStatus()

    Dim lState As Long
    
    lState = OPOSScale1.State
    
    Select Case (lState)
        Case OPOS_S_CLOSED:
            lblState.Caption = "OPOS_S_CLOSED"
            
        Case OPOS_S_IDLE:
            lblState.Caption = "OPOS_S_IDLE"
            
        Case OPOS_S_BUSY:
            lblState.Caption = "OPOS_S_BUSY"
            
        Case OPOS_S_ERROR:
            lblState.Caption = "OPOS_S_ERROR"
            
        Case Else:
            lblState.Caption = CStr(lState)
    End Select

End Sub

Private Sub UpdateDeviceStatusIndicators()

    If (mbln_DeviceIsOpen = True) Then
        sbrStatus(COMMON_PANEL).Panels.Item(OPENED_STATUS).Text = "Opened: YES"
        sbrStatus(SPECIFIC_PANEL).Panels.Item(OPENED_STATUS).Text = "Opened: YES"
        sbrStatus(ADVANCED_PANEL).Panels.Item(OPENED_STATUS).Text = "Opened: YES"
        frmInitialScaleAttributes.Enabled = False
    Else
        sbrStatus(COMMON_PANEL).Panels.Item(OPENED_STATUS).Text = "Opened: NO"
        sbrStatus(SPECIFIC_PANEL).Panels.Item(OPENED_STATUS).Text = "Opened: NO"
        sbrStatus(ADVANCED_PANEL).Panels.Item(OPENED_STATUS).Text = "Opened: NO"
        frmInitialScaleAttributes.Enabled = True
    End If

    If (mbln_DeviceIsClaimed = True) Then
        sbrStatus(COMMON_PANEL).Panels.Item(CLAIMED_STATUS).Text = "Claimed: YES"
        sbrStatus(SPECIFIC_PANEL).Panels.Item(CLAIMED_STATUS).Text = "Claimed: YES"
        sbrStatus(ADVANCED_PANEL).Panels.Item(CLAIMED_STATUS).Text = "Claimed: YES"
    Else
        sbrStatus(COMMON_PANEL).Panels.Item(CLAIMED_STATUS).Text = "Claimed: NO"
        sbrStatus(SPECIFIC_PANEL).Panels.Item(CLAIMED_STATUS).Text = "Claimed: NO"
        sbrStatus(ADVANCED_PANEL).Panels.Item(CLAIMED_STATUS).Text = "Claimed: NO"
    End If

    If (mbln_DeviceIsEnabled = True) Then
        sbrStatus(COMMON_PANEL).Panels.Item(ENABLED_STATUS).Text = "Enabled: YES"
        sbrStatus(SPECIFIC_PANEL).Panels.Item(ENABLED_STATUS).Text = "Enabled: YES"
        sbrStatus(ADVANCED_PANEL).Panels.Item(ENABLED_STATUS).Text = "Enabled: YES"
    Else
        sbrStatus(COMMON_PANEL).Panels.Item(ENABLED_STATUS).Text = "Enabled: NO"
        sbrStatus(SPECIFIC_PANEL).Panels.Item(ENABLED_STATUS).Text = "Enabled: NO"
        sbrStatus(ADVANCED_PANEL).Panels.Item(ENABLED_STATUS).Text = "Enabled: NO"
    End If

End Sub

Private Sub OpenInitializations()

    'Methods that are enabled as a result of 'Open' but done here not in SO.
    cmdClose.Enabled = True
    cmdClaimDevice.Enabled = True
    lstClaimTimeout.Enabled = True
        
End Sub

Private Sub ClaimInitializations()
   
   'Common Properties (Read/Write) that are initialized as a result of 'Claim'.
 
    cmdReleaseDevice.Enabled = True
    chkDeviceEnabled.Enabled = True
        
End Sub

Private Sub CloseCleanup()

    'Stuff to do after the Close function executes successfully.
    lblOpenResult.Caption = ""
    lblServiceObjectVersion.Caption = ""
    lblServiceObjectDescription.Caption = ""
    lblDeviceName.Caption = ""
    lblDeviceDescription.Caption = ""
    lblState.Caption = ""
    lblClaimed.Caption = ""
    lblDataCount.Caption = ""
    lstBinaryConversion.ListIndex = -1
    
    'Clear the option check boxes.
    'The actual properties were really cleared in the CloseService method in the SO.
    chkDataEventEnabled.Value = BOX_UNCHECKED
    chkDeviceEnabled.Value = BOX_UNCHECKED
    chkFreezeEvents.Value = BOX_UNCHECKED
    chkAutoDisable.Value = BOX_UNCHECKED
    
    lblCapPowerReporting.Caption = ""
    lblPowerState.Caption = ""
    
    'Clear scale-specific property indicators:
    lblCapDisplay.Caption = ""
    lblCapDisplayText.Caption = ""
    lblCapPriceCalculating.Caption = ""
    lblCapTareWeight.Caption = ""
    lblCapZeroScale.Caption = ""
    
    chkAsyncMode.Value = BOX_UNCHECKED
    
    mbln_DeviceIsOpen = False
    mbln_DeviceIsClaimed = False
    mbln_DeviceIsEnabled = False

    UpdateDeviceStatusIndicators
    
End Sub

Private Sub Version10Always()

    'Read and display initial "Common Properties" as supported in OPOS v1.0
    '----------------------------------------------------------------------
    
    Dim l_COVersion As Long
    Dim s_CODescription As String
    
    'Property: State:
    Call UpdateStateStatus
    
    'We can access the CO version and description at any time.
    'Property: ControlObjectVersion -
    l_COVersion = OPOSScale1.ControlObjectVersion
    lblCOVersion.Caption = CStr(l_COVersion)

    'Property: ControlObjectDescription -
    s_CODescription = OPOSScale1.ControlObjectDescription
    lblCODescription.Caption = s_CODescription
    
End Sub

Private Sub Version10()
    
    Dim sCheckHealthText As String
    Dim bClaimed As Boolean
    Dim bDeviceEnabled As Boolean
    Dim bFreezeEvents As Boolean
    Dim sServiceObjectDescription As String
    Dim lServiceObjectVersion As Long
    Dim sDeviceDescription As String
    Dim sDeviceName As String
    Dim lMaximumWeight As Long
    Dim lWeightUnit As Long
  
  
    'Read and display initial "Common Properties" as supported in OPOS v1.0
    '----------------------------------------------------------------------
    
    'Property: CheckHealthText -
    sCheckHealthText = OPOSScale1.CheckHealthText
    lblCheckHealthText.Caption = sCheckHealthText

    'Property: Claimed -
    bClaimed = OPOSScale1.Claimed
    If (bClaimed = True) Then
        lblClaimed.Caption = "TRUE"
    Else
        lblClaimed.Caption = "FALSE"
    End If

    'Property: DeviceEnabled -
    bDeviceEnabled = OPOSScale1.DeviceEnabled
    If (OPOSScale1.DeviceEnabled = True) Then
        chkDeviceEnabled.Value = BOX_CHECKED
    Else
        chkDeviceEnabled.Value = BOX_UNCHECKED
    End If
    
     'Property: FreezeEvents -
    bFreezeEvents = OPOSScale1.FreezeEvents
    If (OPOSScale1.FreezeEvents = True) Then
        chkFreezeEvents.Value = BOX_CHECKED
    Else
        chkFreezeEvents.Value = BOX_UNCHECKED
    End If

    'Properties: ResultCode, ResultCodeExtended -
    Call GetResultCodes
    
    'Property: ServiceObjectDescription -
    sServiceObjectDescription = OPOSScale1.ServiceObjectDescription
    lblServiceObjectDescription.Caption = sServiceObjectDescription

    'Property: ServiceObjectVersion -
    lServiceObjectVersion = OPOSScale1.ServiceObjectVersion
    lblServiceObjectVersion.Caption = CStr(lServiceObjectVersion)

    'Property: DeviceDescription -
    sDeviceDescription = OPOSScale1.DeviceDescription
    lblDeviceDescription.Caption = sDeviceDescription
 
    'Property: DeviceName -
    sDeviceName = OPOSScale1.DeviceName
    lblDeviceName.Caption = sDeviceName


    'Read and display initial "Scale Properties" as supported in OPOS v1.0
    '---------------------------------------------------------------------
    
    'Property: MaximumWeight -
    lMaximumWeight = OPOSScale1.MaximumWeight
    lblMaximumWeight.Caption = CStr(lMaximumWeight)

    'Property: WeightUnit -
    lWeightUnit = OPOSScale1.WeightUnit

    Select Case (lWeightUnit)

        Case SCAL_WU_GRAM:
            lblWeightUnit.Caption = "SCAL_WU_GRAM"

        Case SCAL_WU_KILOGRAM:
            lblWeightUnit.Caption = "SCAL_WU_KILOGRAM"

        Case SCAL_WU_OUNCE:
            lblWeightUnit.Caption = "SCAL_WU_OUNCE"

        Case SCAL_WU_POUND:
            lblWeightUnit.Caption = "SCAL_WU_POUND"

        Case Else:
            lblWeightUnit.Caption = CStr(lWeightUnit)

    End Select
    
End Sub

Private Sub Version12()

    Dim lret As Long
    Dim bCapDisplay As Boolean

   
    'Read and display initial "Common Properties" as supported in OPOS v1.2
    '----------------------------------------------------------------------
        
    'Property: BinaryConversion -
    lret = OPOSScale1.BinaryConversion

    Select Case (lret)
        Case OPOS_BC_NONE:
            lstBinaryConversion.ListIndex = 0

        Case OPOS_BC_NIBBLE:
            lstBinaryConversion.ListIndex = 1

        Case OPOS_BC_DECIMAL:
            lstBinaryConversion.ListIndex = 2

        Case Else
            lstBinaryConversion.ListIndex = -1
    End Select


    'Read and display initial "Scale Properties" as supported in OPOS v1.2
    '---------------------------------------------------------------------
    
    'Property: CapDisplay -
    bCapDisplay = OPOSScale1.CapDisplay

    If (bCapDisplay = True) Then
        lblCapDisplay.Caption = "YES"
    Else
        lblCapDisplay.Caption = "NO"
    End If
    
End Sub
    

Private Sub Version13()

    Dim bAutoDisable As Boolean
    Dim lCapPowerReporting As Long
    Dim lDataCount As Long
    Dim bDataEventEnabled As Boolean
    Dim lPowerNotify As Long
    Dim lPowerState As Long
    Dim bCapDisplayText As Boolean
    Dim bCapPriceCalculating As Boolean
    Dim bCapTareWeight As Boolean
    Dim bCapZeroScale As Boolean
    Dim bAsyncMode As Boolean
    Dim lMaxDisplayTextChars As Long
    Dim cSalesPrice As Currency
    Dim lTareWeight As Long
    Dim cUnitPrice As Currency
    
   
    'Read and display initial "Common Properties" as supported in OPOS v1.3
    '----------------------------------------------------------------------
        
    'Property: AutoDisable -
    bAutoDisable = OPOSScale1.AutoDisable
    If (bAutoDisable = True) Then
        chkAutoDisable.Value = BOX_CHECKED
    Else
        chkAutoDisable.Value = BOX_UNCHECKED
    End If
 
    'Property: CapPowerReporting -
    lCapPowerReporting = OPOSScale1.CapPowerReporting
    lblCapPowerReporting.Caption = CCapPowerReportingStr(lCapPowerReporting)
    
    'Property: DataCount -
    lDataCount = OPOSScale1.DataCount
    lblDataCount.Caption = CStr(lDataCount)

    'Property: DataEventEnabled -
    bDataEventEnabled = OPOSScale1.DataEventEnabled
    If (bDataEventEnabled = True) Then
        chkDataEventEnabled.Value = BOX_CHECKED
    Else
        chkDataEventEnabled.Value = BOX_UNCHECKED
    End If
    
    'Property: PowerNotify -
    lPowerNotify = OPOSScale1.PowerNotify
    Select Case (lPowerNotify)
        Case OPOS_PN_DISABLED:
            lstPowerNotify.ListIndex = 0

        Case OPOS_PN_ENABLED:
            lstPowerNotify.ListIndex = 1

        Case Else:
            lstPowerNotify.ListIndex = -1
    End Select
    
    'Property: PowerState -
    lPowerState = OPOSScale1.PowerState
    lblPowerState.Caption = CPowerStateStr(lPowerState)
    
    'Read and display initial "Scale Properties" as supported in OPOS v1.3
    '---------------------------------------------------------------------
    
    'Property: CapDisplayText -
    bCapDisplayText = OPOSScale1.CapDisplayText
    If (bCapDisplayText = True) Then
        lblCapDisplayText.Caption = "YES"
    Else
        lblCapDisplayText.Caption = "NO"
    End If
    
    'Property: CapPriceCalculating -
    bCapPriceCalculating = OPOSScale1.CapPriceCalculating
    If (bCapPriceCalculating = True) Then
        lblCapPriceCalculating.Caption = "YES"
    Else
        lblCapPriceCalculating.Caption = "NO"
    End If
    
    'Property: CapTareWeight -
    bCapTareWeight = OPOSScale1.CapTareWeight
    If (bCapTareWeight = True) Then
        lblCapTareWeight.Caption = "YES"
    Else
        lblCapTareWeight.Caption = "NO"
    End If
    
    'Property: CapZeroScale -
    bCapZeroScale = OPOSScale1.CapZeroScale
    If (bCapZeroScale = True) Then
        lblCapZeroScale.Caption = "YES"
    Else
        lblCapZeroScale.Caption = "NO"
    End If
    
    'Property: AsyncMode -
    bAsyncMode = OPOSScale1.AsyncMode
    If (bAsyncMode = True) Then
        chkAsyncMode.Value = BOX_CHECKED
    Else
        chkAsyncMode.Value = BOX_UNCHECKED
    End If
    
    'Property: MaxDisplayTextChars -
    lMaxDisplayTextChars = OPOSScale1.MaxDisplayTextChars
    lblMaxDisplayTextChars.Caption = CStr(lMaxDisplayTextChars)
    
    'Property: SalesPrice -
    cSalesPrice = OPOSScale1.SalesPrice
    lblSalesPrice.Caption = CStr(cSalesPrice)
    
    'Property: TareWeight -
    lTareWeight = OPOSScale1.TareWeight
    txtTareWeight.Text = CStr(lTareWeight)
    
    'Property: UnitPrice -
    cUnitPrice = OPOSScale1.UnitPrice
    txtUnitPrice.Text = CStr(cUnitPrice)
    
End Sub
  
Private Sub Version15()

    Dim lOR As Long
   
   
    'Read and display initial "Common Properties" as supported in OPOS v1.5
    '----------------------------------------------------------------------
        
    'Property: OpenResult -
    lOR = OPOSScale1.OpenResult
    lblOpenResult.Caption = COpenResultStringStr(lOR)
    

    'Read and display initial "Scale Properties" as supported in OPOS v1.5
    '---------------------------------------------------------------------
    'NONE
    
End Sub

Private Sub timKeepAliveTestDisplay_Timer()

    Dim lWeight     As Long
    Dim lTimeout    As Long
    Dim lret        As Long
    Dim sWeight     As String
    Dim msg      As String
       
    'Determines the number of milliseconds to wait for a settled weight.
    lTimeout = lstReadWeightTimeout.ItemData(lstReadWeightTimeout.ListIndex)
    
    If ((mbln_DeviceIsOpen = True) And (mbln_DeviceIsClaimed = True) And (mbln_DeviceIsEnabled = True)) Then
        'Do a synchronous reading of the current weight from the scale:
        lret = OPOSScale1.ReadWeight(lWeight, lTimeout)
        If (lret = OPOS_SUCCESS) Then
            lblKeepAliveWeight.Caption = Format$(lWeight, "000")
        Else
            lblKeepAliveWeight.Caption = ""
        End If
        Beep
    Else
        lblKeepAliveWeight.Caption = ""
        msg = "Error trying to read weight." & Chr(13)
        msg = msg & "The keep alive weight reading failed"
        MsgBox msg
    End If

End Sub

Private Sub txtInitialMaxDisplayTextChars_GotFocus()

    txtInitialMaxDisplayTextChars.SelStart = 0
    txtInitialMaxDisplayTextChars.SelLength = Len(txtInitialMaxDisplayTextChars.Text)
    
End Sub

Private Sub txtInitialMaxDisplayTextChars_KeyPress(KeyAscii As Integer)

    Dim sKey As String
    Dim msg As String
    Dim lNewValue As Long
    Const MAX_VALUE = 256
    
    sKey = Chr(KeyAscii)                                'Convert key to string
    
    Select Case (sKey)
        Case "0" To "9":
            lNewValue = Val(Left(txtInitialMaxDisplayTextChars.Text, txtInitialMaxDisplayTextChars.SelStart) + sKey + _
                        Mid(txtInitialMaxDisplayTextChars.Text, txtInitialMaxDisplayTextChars.SelStart + txtInitialMaxDisplayTextChars.SelLength + 1))
                        
            If (lNewValue > MAX_VALUE) Then
                KeyAscii = 0
                
                msg = "Please limit numeric value entry to the range 0 - " & CStr(MAX_VALUE)
                MsgBox msg, vbExclamation, "Invalid entry"
            End If
        
        Case Chr(ASCII_BS):                             'Allow backspace
        
        Case Else
            KeyAscii = 0
    End Select
    
End Sub

Private Sub txtInitialMaxDisplayTextChars_LostFocus()

    Dim ret
    Dim devName As String
    Dim szValue As String
    
    'Set the initial "MaxDisplayTextChars" setting for the scale
    devName = lstProfiles.Text
    szValue = txtInitialMaxDisplayTextChars.Text
        
    ret = SetOPOSRegValue(devClass, devName, "Initial_MaxDisplayTextChars", szValue, "")

End Sub

Private Sub txtInitialMaxDisplayTextChars_Validate(Cancel As Boolean)

    If (txtInitialMaxDisplayTextChars.Text = "") Then
        txtInitialMaxDisplayTextChars.Text = "0"
    End If
    
End Sub

Private Sub txtInitialMaximumWeight_GotFocus()

    txtInitialMaximumWeight.SelStart = 0
    txtInitialMaximumWeight.SelLength = Len(txtInitialMaximumWeight.Text)

End Sub

Private Sub txtInitialMaximumWeight_KeyPress(KeyAscii As Integer)

    Dim sKey As String
    Dim lNewValue As Long
    Dim msg As String
    Const MAX_VALUE = 100000
    
    sKey = Chr(KeyAscii)                                'Convert key to string
    
    Select Case (sKey)
    
        Case "0" To "9":
            lNewValue = Val(Left(txtInitialMaximumWeight.Text, txtInitialMaximumWeight.SelStart) + sKey + _
                        Mid(txtInitialMaximumWeight.Text, txtInitialMaximumWeight.SelStart + txtInitialMaximumWeight.SelLength + 1))
                        
            If (lNewValue > MAX_VALUE) Then
                KeyAscii = 0
                
                msg = "Please limit numeric value entry to the range 0 - " & CStr(MAX_VALUE)
                MsgBox msg, vbExclamation, "Invalid entry"
            End If
        
        Case Chr(ASCII_BS):                             'Allow backspace
        
        Case Else
            KeyAscii = 0
            
    End Select

End Sub

Private Sub txtInitialMaximumWeight_LostFocus()

    Dim ret
    Dim devName As String
    Dim szValue As String
    
    'Set the initial "MaximumWeight" setting for the scale
    devName = lstProfiles.Text
    szValue = txtInitialMaximumWeight.Text
        
    ret = SetOPOSRegValue(devClass, devName, "Initial_MaximumWeight", szValue, "Initial MaximumWeight property")
    
End Sub

Private Sub txtInitialMaximumWeight_Validate(Cancel As Boolean)

    If (txtInitialMaximumWeight.Text = "") Then
        txtInitialMaximumWeight.Text = "0"
    End If
    
End Sub

Private Function CPowerStateStr(ByVal lPowerState As Long) As String

    Dim sret As String
    
    Select Case (lPowerState)
    
        Case OPOS_PS_UNKNOWN:
            sret = "OPOS_PS_UNKNOWN"

        Case OPOS_PS_ONLINE:
            sret = "OPOS_PS_ONLINE"

        Case OPOS_PS_OFF:
            sret = "OPOS_PS_OFF"

        Case OPOS_PS_OFFLINE:
            sret = "OPOS_PS_OFFLINE"

        Case OPOS_PS_OFF_OFFLINE:
            sret = "OPOS_PS_OFF_OFFLINE"

        Case Else:
            sret = CStr(lPowerState)
            
    End Select
    
    CPowerStateStr = sret
    
End Function

Private Function CCapPowerReportingStr(ByVal lCapPowerReporting As Long) As String

    Dim sret As String
    
    Select Case (lCapPowerReporting)
    
        Case OPOS_PR_NONE:
            sret = "OPOS_PR_NONE"

        Case OPOS_PR_STANDARD:
            sret = "OPOS_PR_STANDARD"

        Case OPOS_PR_ADVANCED:
            sret = "OPOS_PR_ADVANCED"

        Case Else:
            sret = CStr(lCapPowerReporting)
    
    End Select
    
    CCapPowerReportingStr = sret

End Function

Private Sub EnableTheDevice()

    ' This support code is executed after it has been determined that the device has been opened
    ' successfully.
    
    Dim lret As Long
    Dim bret As Boolean
        
    mbln_DeviceIsEnabled = True
    sbrStatus(COMMON_PANEL).Panels.Item(ENABLED_STATUS).Text = "Enabled: YES"
    sbrStatus(SPECIFIC_PANEL).Panels.Item(ENABLED_STATUS).Text = "Enabled: YES"
    sbrStatus(ADVANCED_PANEL).Panels.Item(ENABLED_STATUS).Text = "Enabled: YES"
    
    'Access the WeightUnits attribute as read from the scale:
    lret = OPOSScale1.WeightUnit
    Select Case (lret)
        Case SCAL_WU_GRAM:
            lblWeightUnit.Caption = "SCAL_WU_GRAM"
        Case SCAL_WU_KILOGRAM:
            lblWeightUnit.Caption = "SCAL_WU_KILOGRAM"
        Case SCAL_WU_OUNCE:
            lblWeightUnit.Caption = "SCAL_WU_OUNCE"
        Case SCAL_WU_POUND:
            lblWeightUnit.Caption = "SCAL_WU_POUND"
        Case Else
            lblWeightUnit.Caption = CStr(lret)
    End Select
    
    'Access the MaximumWeight attribute as read from the scale:
    lret = OPOSScale1.MaximumWeight
    lblMaximumWeight.Caption = CStr(lret)

    'Now some special handling. Since our scale might have the ability to return it's capability
    'attributes (if it supports OPOS extension commands to the ECR protocol), we might have to
    'override some attributes.
            
    'Access the CapDisplay attribute as read from the scale:
    bret = OPOSScale1.CapDisplay
    If (bret = True) Then
        lblCapDisplay.Caption = "YES"
    Else
        lblCapDisplay.Caption = "NO"
    End If
    
    'Access the CapDisplayText attribute as read from the scale:
    bret = OPOSScale1.CapDisplayText
    If (bret = True) Then
        lblCapDisplayText.Caption = "YES"
    Else
        lblCapDisplayText.Caption = "NO"
    End If
    
    'Access the CapPriceCalculating attribute as read from the scale:
    bret = OPOSScale1.CapPriceCalculating
    If (bret = True) Then
        lblCapPriceCalculating.Caption = "YES"
    Else
        lblCapPriceCalculating.Caption = "NO"
    End If
    
    'Access the CapTareWeight attribute as read from the scale:
    bret = OPOSScale1.CapTareWeight
    If (bret = True) Then
        lblCapTareWeight.Caption = "YES"
    Else
        lblCapTareWeight.Caption = "NO"
    End If
    
    'Access the CapZeroScale attribute as read from the scale:
    bret = OPOSScale1.CapZeroScale
    If (bret = True) Then
        lblCapZeroScale.Caption = "YES"
    Else
        lblCapZeroScale.Caption = "NO"
    End If
    
     'Access the MaxDisplayTextChars attribute as read from the scale:
    lret = OPOSScale1.MaxDisplayTextChars
    lblMaxDisplayTextChars.Caption = CStr(lret)
        
End Sub

Private Sub DisableTheDevice()

    ' This support code is executed when the device has been disabled.
    
    mbln_DeviceIsEnabled = False
    sbrStatus(COMMON_PANEL).Panels.Item(ENABLED_STATUS).Text = "Enabled: NO"
    sbrStatus(SPECIFIC_PANEL).Panels.Item(ENABLED_STATUS).Text = "Enabled: NO"
    sbrStatus(ADVANCED_PANEL).Panels.Item(ENABLED_STATUS).Text = "Enabled: NO"
    
    'Clear the WeightUnits attribute display::
    lblWeightUnit.Caption = ""
    
    'Clear the MaximumWeight attribute display:
    lblMaximumWeight.Caption = ""

    'Clear the CapDisplay attribute display:
    lblCapDisplay.Caption = ""
    
    'Clear the CapDisplayText attribute display:
    lblCapDisplayText.Caption = ""
    
    'Clear the CapPriceCalculating attribute display:
    lblCapPriceCalculating.Caption = ""
    
    'Clear the CapTareWeight attribute display:
    lblCapTareWeight.Caption = ""
    
    'Clear the CapZeroScale attribute display:
    lblCapZeroScale.Caption = ""
    
     'Clear the MaxDisplayTextChars attribute display:
    lblMaxDisplayTextChars.Caption = ""
        
End Sub

Private Function COPOSResultCodeExtStr(ByVal lRCE As Long) As String

    Dim sret As String
    
    Select Case (lRCE)

        Case OPOS_ESCAL_OVERWEIGHT:
            sret = "OPOS_ESCAL_OVERWEIGHT"
        
        Case Else:
            sret = CStr(lRCE)
    
    End Select

    COPOSResultCodeExtStr = sret
    
End Function

Private Function CWTResultCodeExtStr(ByVal lRCE As Long) As String

    Dim sret As String
    
    Select Case (lRCE)
        
        Case WT_NOERROR:
            sret = "WT_NOERROR"
            
        Case WT_ESCAL_NOTSTABLE:
            sret = "WT_ESCAL_NOTSTABLE"
            
        Case WT_ESCAL_WEIGHTISZERO:
            sret = "WT_ESCAL_WEIGHTISZERO"
            
        Case WT_ESCAL_BELOWZERO:
            sret = "WT_ESCAL_BELOWZERO"
            
        Case WT_ESCAL_TXDFAILED:
            sret = "WT_ESCAL_TXDFAILED"
            
        Case WT_ESCAL_RXDBADPACKET:
            sret = "WT_ESCAL_RXDBADPACKET"
            
        Case WT_ESCAL_RXDINVALIDCOMMAND:
            sret = "WT_ESCAL_RXDINVALIDCOMMAND"
            
        Case WT_ESCAL_RXDTIMEOUT:
            sret = "WT_ESCAL_RXDTIMEOUT"
            
        Case WT_ESCAL_CALIBRATIONERROR:
            sret = "WT_ESCAL_CALIBRATIONERROR"
            
        Case WT_ESCAL_INITIALZEROERROR:
            sret = "WT_ESCAL_INITIALZEROERROR"
            
        Case WT_ESCAL_READTIMEOUT:
            sret = "WT_ESCAL_READTIMEOUT"
            
        Case WT_ESCAL_NULL:
            sret = ""
            
        Case WT_ESCAL_OTHERERROR:
            sret = "WT_ESCAL_OTHERERROR"
            
        Case Else
            sret = CStr(lRCE)
            
    End Select
    
    CWTResultCodeExtStr = sret
    
End Function

Private Function CWTMfgResultCodeExtStr(ByVal lRCE As Long) As String

    Dim sret As String
    
    Select Case (lRCE)
        
        Case WT_MFG_NULL:
            sret = ""
            
        Case WT_MFG_ECRPROTO:
            sret = "WT_MFG_ECRPROTO"
            
        Case WT_MFG_OPOSPROTO:
            sret = "WT_MFG_OPOSPROTO"
            
        Case WT_MFG_VALIDLATCHEDVALUE:
            sret = "WT_MFG_VALIDLATCHEDVALUE"
            
        Case WT_MFG_INVALIDLATCHEDVALUE:
            sret = "WT_MFG_INVALIDLATCHEDVALUE"
            
        Case WT_MFG_TRANSACTIONLATCHDISABLED:
            sret = "WT_MFG_TRANSACTIONLATCHDISABLED"
            
        Case WT_MFG_TRANSACTIONLATCHENABLED:
            sret = "WT_MFG_TRANSACTIONLATCHENABLED"
            
        Case WT_MFG_OTHERERROR:
            sret = "WT_MFG_OTHERERROR"
            
        Case Else
            sret = CStr(lRCE)
            
    End Select
    
    CWTMfgResultCodeExtStr = sret
    
End Function
Private Function ValidateCurrencyEntry(sValue As String) As String

    ' This function is used to validate a users currency input.
    ' We expect worst-case input of XXX.XX
    
    Dim bError As Boolean
    Dim iLength As Integer
    Dim iDptCount As Integer
    Dim iDptPosition As Integer
    Dim i As Integer
    Dim sNewValue As String
    Dim sThisChar As String * 1
    
    bError = False
    sNewValue = ""
    iDptCount = 0
    iLength = Len(sValue)
    If (iLength = 0 Or iLength > 6) Then
        bError = True
    Else
        iDptPosition = InStr(1, sValue, ".")
        If (iDptPosition = 0) Then
            bError = True
        Else
            If (iDptPosition <> (iLength - 2)) Then
                bError = True
            Else
                For i = 1 To iLength
                    sThisChar = Mid(sValue, i, 1)
                    Select Case (sThisChar)
                        Case "0" To "9"
                            sNewValue = sNewValue & sThisChar
                            
                        Case "."
                            iDptCount = iDptCount + 1
                            If (iDptCount > 1) Then
                                bError = True
                                Exit For
                            Else
                                sNewValue = sNewValue & sThisChar
                            End If
                            
                        Case Else
                            bError = True
                            Exit For
                    End Select
                Next i
            End If
        End If
    End If

    If (bError = True) Then
        sNewValue = "0.00"
        Beep
    End If
    
    ValidateCurrencyEntry = sNewValue
    
End Function


'Private Sub btnSetLogFile_Click()
'
'    Dim winLogFileObj As New winLogFile
'
'    winLogFileObj.SetDefaultLogFile = lblLogFile.Caption
'    winLogFileObj.Show vbModal
'
'End Sub
'
'Private Sub lstVerbosity_Click()
'
'    Dim i As Integer
'    Dim ret As Long
'    Dim devName As String
'    Dim szValue As String
'    Dim curVerbosity As Integer
'
'    'Set the Verbosity for the scale
'    devName = lstProfiles.Text
'    szValue = lstVerbosity.Text
'
'    If (devName = "") Then
'        lstVerbosity.ListIndex = 0
'    Else
'        i = 1
'        curVerbosity = 0
'        'Determine the index for the current Verbosity, based on its value
'        While i <= lstVerbosity.ListCount And curVerbosity = 0
'            If (UCase(arrInstances(i).szDevName) = UCase(devName)) Then
'                curVerbosity = i
'            End If
'            i = i + 1
'        Wend
'        ret = SetOPOSRegValue(devClass, devName, "LogVerbosity", szValue, "Logging verbosity level")
'    End If
'
'End Sub

'Private Sub mnuViewLog_Click()
'
'    ' Change the global registry property that specifies the log file for all SO drivers
'    winLogFile.Show 1
'
'End Sub



