📄 frmmain.frm
字号:
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Machine Number: "
BeginProperty Font
Name = "Times New Roman"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 60
TabIndex = 19
Top = 900
Width = 1695
End
Begin VB.Label lblComPort
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "ComPort : "
BeginProperty Font
Name = "Times New Roman"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 660
TabIndex = 5
Top = 345
Width = 1005
End
End
Begin VB.Frame Frame2
Caption = " "
Height = 1590
Left = 240
TabIndex = 6
Top = 3210
Width = 3660
Begin VB.TextBox txtPortNo
BeginProperty Font
Name = "Times New Roman"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 1725
TabIndex = 8
Text = "4370"
Top = 960
Width = 1692
End
Begin VB.TextBox txtIPAddress
BeginProperty Font
Name = "Times New Roman"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 1725
TabIndex = 7
Text = "192.168.1.201"
Top = 405
Width = 1692
End
Begin VB.Label lblPortNo
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Port Number :"
BeginProperty Font
Name = "Times New Roman"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 300
TabIndex = 10
Top = 960
Width = 1305
End
Begin VB.Label lblIPAddress
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Ip Address :"
BeginProperty Font
Name = "Times New Roman"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 300
TabIndex = 9
Top = 465
Width = 1125
End
End
Begin zkemkeeperCtl.CZKEM CZKEM1
Height = 495
Left = 840
OleObjectBlob = "frmMain.frx":04D8
TabIndex = 17
Top = 240
Width = 855
End
Begin VB.Label lbSubject
Alignment = 2 'Center
AutoSize = -1 'True
BackColor = &H80000013&
BackStyle = 0 'Transparent
Caption = "Time recorder sample"
BeginProperty Font
Name = "Times New Roman"
Size = 20.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 465
Left = 2010
TabIndex = 0
Top = 195
Width = 3885
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public vMachineNumber As Integer
Private Sub cmbComPort_Change()
If cmbComPort.Text = "" Then Exit Sub
CZKEM1.CommPort = cmbComPort.Text
End Sub
Private Sub cmbComPort_Click()
CZKEM1.CommPort = cmbComPort.ListIndex + 1
End Sub
Private Sub cmdConnect_Click()
Dim lngComPort As Integer
Dim lngMachineNum As Integer
Dim lngBaudRate As Long
Dim bConn As Boolean
If cmdConnect.Caption = "Disconnect" Then
CZKEM1.EnableDevice vMachineNumber, True
CZKEM1.Disconnect
cmdConnect.Caption = "Connect"
Exit Sub
End If
lngComPort = CLng(cmbComPort.Text)
lngMachineNum = CLng(cmbMachineNum.Text)
lngBaudRate = CLng(cmbBaudRate.Text)
If optSerialDevice.Value Then
bConn = CZKEM1.Connect_Com(lngComPort, lngMachineNum, CLng(lngBaudRate))
vMachineNumber = lngMachineNum
If bConn Then cmdConnect.Caption = "Disconnect"
ElseIf optNetworkDevice.Value Then
bConn = CZKEM1.Connect_Net(txtIPAddress.Text, CLng(txtPortNo.Text))
vMachineNumber = 1
If bConn Then cmdConnect.Caption = "Disconnect"
End If
If bConn Then CZKEM1.EnableDevice vMachineNumber, False
End Sub
Private Sub cmdEnrollData_Click()
Me.Visible = False
frmEnroll.Visible = True
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdLogData_Click()
Me.Visible = False
frmLog.Visible = True
End Sub
Private Sub cmdProuctCode_Click()
Me.Visible = False
frmUserInfo.Visible = True
End Sub
Private Sub cmdSystemInfo_Click()
Me.Visible = False
frmSystemInfo.Visible = True
End Sub
Private Sub optNetworkDevice_Click()
Dim lpszIPAddress As String
If optNetworkDevice = True Then
lblComPort.Enabled = False
cmbComPort.Enabled = False
lblIPAddress.Enabled = True
txtIPAddress.Enabled = True
lblPortNo.Enabled = True
txtPortNo.Enabled = True
lpszIPAddress = txtIPAddress
Frame3.Enabled = False
Else
lblComPort.Enabled = True
cmbComPort.Enabled = True
lblIPAddress.Enabled = False
txtIPAddress.Enabled = False
lblPortNo.Enabled = False
txtPortNo.Enabled = False
CZKEM1.CommPort = cmbComPort.ListIndex + 1
End If
End Sub
Private Sub optSerialDevice_Click()
Dim lpszIPAddress As String
If optSerialDevice = True Then
lblComPort.Enabled = True
cmbComPort.Enabled = True
lblIPAddress.Enabled = False
txtIPAddress.Enabled = False
lblPortNo.Enabled = False
txtPortNo.Enabled = False
CZKEM1.CommPort = cmbComPort.ListIndex + 1
Else
lblComPort.Enabled = False
cmbComPort.Enabled = False
lblIPAddress.Enabled = True
txtIPAddress.Enabled = True
lblPortNo.Enabled = True
txtPortNo.Enabled = True
lpszIPAddress = txtIPAddress
CZKEM1.SetIPAddress lpszIPAddress, CLng(txtPortNo.Text)
End If
End Sub
Private Sub txtIPAddress_Change()
Dim lpszIPAddress As String
'If txtIPAddress = "" Then Exit Sub
'If txtPortNo = "" Then Exit Sub
'lpszIPAddress = txtIPAddress
'CZKEM1.SetIPAddress lpszIPAddress, CLng(txtPortNo.Text)
End Sub
Private Sub txtPortNo_Change()
Dim lpszIPAddress As String
If txtIPAddress = "" Then Exit Sub
If txtPortNo = "" Then Exit Sub
lpszIPAddress = txtIPAddress
CZKEM1.SetIPAddress lpszIPAddress, CLng(txtPortNo.Text)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -