📄 frmmain.frm
字号:
With txtCPZ
If KeyAscii = vbKeyUp Or KeyAscii = vbKeyDown Or KeyAscii = vbKeyRight Or KeyAscii = vbKeyLeft Or KeyAscii = vbKeyEnd Or KeyAscii = vbKeyHome Or KeyAscii = vbKeyPageDown Or KeyAscii = vbKeyPageUp Then
Exit Sub
End If
If KeyAscii = vbKeyBack Then
KeyAscii = 0
If .SelStart <> 0 Then
.SelStart = .SelStart - 1
.SelLength = 1
.SelText = "F"
.SelStart = .SelStart - 1
End If
ElseIf (KeyAscii >= Asc("0") And KeyAscii <= Asc("9")) _
Or (KeyAscii >= Asc("A") And KeyAscii <= Asc("F")) _
Or (KeyAscii >= Asc("a") And KeyAscii <= Asc("f")) Then
'大小写转换
If KeyAscii >= Asc("a") And KeyAscii <= Asc("f") Then
KeyAscii = KeyAscii + Asc("A") - Asc("a")
End If
If .SelStart < .MaxLength Then
.SelLength = 1
.SelText = Chr$(KeyAscii)
End If
End If
KeyAscii = 0
.SelLength = 0
End With
End Sub
Private Sub txtECX_KeyPress(KeyAscii As Integer)
With txtECX
If KeyAscii = vbKeyUp Or KeyAscii = vbKeyDown Or KeyAscii = vbKeyRight Or KeyAscii = vbKeyLeft Or KeyAscii = vbKeyEnd Or KeyAscii = vbKeyHome Or KeyAscii = vbKeyPageDown Or KeyAscii = vbKeyPageUp Then
Exit Sub
End If
If KeyAscii = vbKeyBack Then
KeyAscii = 0
If .SelStart <> 0 Then
.SelStart = .SelStart - 1
.SelLength = 1
.SelText = "F"
.SelStart = .SelStart - 1
End If
ElseIf (KeyAscii >= Asc("0") And KeyAscii <= Asc("9")) _
Or (KeyAscii >= Asc("A") And KeyAscii <= Asc("F")) _
Or (KeyAscii >= Asc("a") And KeyAscii <= Asc("f")) Then
'大小写转换
If KeyAscii >= Asc("a") And KeyAscii <= Asc("f") Then
KeyAscii = KeyAscii + Asc("A") - Asc("a")
End If
If .SelStart < .MaxLength Then
.SelLength = 1
.SelText = Chr$(KeyAscii)
End If
End If
KeyAscii = 0
.SelLength = 0
End With
End Sub
Private Sub txtEXAC_KeyPress(KeyAscii As Integer)
With txtEXAC
If KeyAscii = vbKeyUp Or KeyAscii = vbKeyDown Or KeyAscii = vbKeyRight Or KeyAscii = vbKeyLeft Or KeyAscii = vbKeyEnd Or KeyAscii = vbKeyHome Or KeyAscii = vbKeyPageDown Or KeyAscii = vbKeyPageUp Then
Exit Sub
End If
If KeyAscii = vbKeyBack Then
KeyAscii = 0
If .SelStart <> 0 Then
.SelStart = .SelStart - 1
.SelLength = 1
.SelText = "F"
.SelStart = .SelStart - 1
End If
ElseIf (KeyAscii >= Asc("0") And KeyAscii <= Asc("9")) _
Or (KeyAscii >= Asc("A") And KeyAscii <= Asc("F")) _
Or (KeyAscii >= Asc("a") And KeyAscii <= Asc("f")) Then
'大小写转换
If KeyAscii >= Asc("a") And KeyAscii <= Asc("f") Then
KeyAscii = KeyAscii + Asc("A") - Asc("a")
End If
If .SelStart < .MaxLength Then
.SelLength = 1
.SelText = Chr$(KeyAscii)
End If
End If
KeyAscii = 0
.SelLength = 0
End With
End Sub
Private Sub txtIssue_KeyPress(KeyAscii As Integer)
With txtIssue
If KeyAscii = vbKeyUp Or KeyAscii = vbKeyDown Or KeyAscii = vbKeyRight Or KeyAscii = vbKeyLeft Or KeyAscii = vbKeyEnd Or KeyAscii = vbKeyHome Or KeyAscii = vbKeyPageDown Or KeyAscii = vbKeyPageUp Then
Exit Sub
End If
If KeyAscii = vbKeyBack Then
KeyAscii = 0
If .SelStart <> 0 Then
.SelStart = .SelStart - 1
.SelLength = 1
.SelText = "F"
.SelStart = .SelStart - 1
End If
ElseIf (KeyAscii >= Asc("0") And KeyAscii <= Asc("9")) _
Or (KeyAscii >= Asc("A") And KeyAscii <= Asc("F")) _
Or (KeyAscii >= Asc("a") And KeyAscii <= Asc("f")) Then
'大小写转换
If KeyAscii >= Asc("a") And KeyAscii <= Asc("f") Then
KeyAscii = KeyAscii + Asc("A") - Asc("a")
End If
If .SelStart < .MaxLength Then
.SelLength = 1
.SelText = Chr$(KeyAscii)
End If
End If
KeyAscii = 0
.SelLength = 0
End With
End Sub
Private Sub txtModifyEX_Click()
Dim buf(128) As Byte
Dim hr As Long
SCHelp_HexStringToBytes txtECX.Text, buf(0), 2
Select Case cmbDataBuf.ListIndex
Case 0
hr = SC1604_ChangePwd(hPort, SC1604ZONE_EZ1, buf(0), buf(1))
Case 1
hr = SC1604_ChangePwd(hPort, SC1604ZONE_EZ2, buf(0), buf(1))
Case 2
hr = SC1604_ChangePwd(hPort, SC1604ZONE_EZ3, buf(0), buf(1))
Case 3
hr = SC1604_ChangePwd(hPort, SC1604ZONE_EZ4, buf(0), buf(1))
End Select
If hr <> 0 Then
MsgBox "密码更改成功!"
Else
ReportError
End If
End Sub
Private Sub txtMTZ_KeyPress(KeyAscii As Integer)
With txtMTZ
If KeyAscii = vbKeyUp Or KeyAscii = vbKeyDown Or KeyAscii = vbKeyRight Or KeyAscii = vbKeyLeft Or KeyAscii = vbKeyEnd Or KeyAscii = vbKeyHome Or KeyAscii = vbKeyPageDown Or KeyAscii = vbKeyPageUp Then
Exit Sub
End If
If KeyAscii = vbKeyBack Then
KeyAscii = 0
If .SelStart <> 0 Then
.SelStart = .SelStart - 1
.SelLength = 1
.SelText = "F"
.SelStart = .SelStart - 1
End If
ElseIf (KeyAscii >= Asc("0") And KeyAscii <= Asc("9")) _
Or (KeyAscii >= Asc("A") And KeyAscii <= Asc("F")) _
Or (KeyAscii >= Asc("a") And KeyAscii <= Asc("f")) Then
'大小写转换
If KeyAscii >= Asc("a") And KeyAscii <= Asc("f") Then
KeyAscii = KeyAscii + Asc("A") - Asc("a")
End If
If .SelStart < .MaxLength Then
.SelLength = 1
.SelText = Chr$(KeyAscii)
End If
End If
KeyAscii = 0
.SelLength = 0
End With
End Sub
Private Sub txtModifySX_Click()
Dim buf(128) As Byte
Dim hr As Long
SCHelp_HexStringToBytes txtSCX.Text, buf(0), 2
Select Case cmbDataBuf.ListIndex
Case 0
hr = SC1604_ChangePwd(hPort, SC1604ZONE_SC1, buf(0), buf(1))
Case 1
hr = SC1604_ChangePwd(hPort, SC1604ZONE_SC2, buf(0), buf(1))
Case 2
hr = SC1604_ChangePwd(hPort, SC1604ZONE_SC3, buf(0), buf(1))
Case 3
hr = SC1604_ChangePwd(hPort, SC1604ZONE_SC4, buf(0), buf(1))
End Select
If hr <> 0 Then
MsgBox "密码更改成功!"
Else
ReportError
End If
End Sub
Private Sub txtSC_KeyPress(KeyAscii As Integer)
With txtSC
If KeyAscii = vbKeyUp Or KeyAscii = vbKeyDown Or KeyAscii = vbKeyRight Or KeyAscii = vbKeyLeft Or KeyAscii = vbKeyEnd Or KeyAscii = vbKeyHome Or KeyAscii = vbKeyPageDown Or KeyAscii = vbKeyPageUp Then
Exit Sub
End If
If KeyAscii = vbKeyBack Then
KeyAscii = 0
If .SelStart <> 0 Then
.SelStart = .SelStart - 1
.SelLength = 1
.SelText = "F"
.SelStart = .SelStart - 1
End If
ElseIf (KeyAscii >= Asc("0") And KeyAscii <= Asc("9")) _
Or (KeyAscii >= Asc("A") And KeyAscii <= Asc("F")) _
Or (KeyAscii >= Asc("a") And KeyAscii <= Asc("f")) Then
'大小写转换
If KeyAscii >= Asc("a") And KeyAscii <= Asc("f") Then
KeyAscii = KeyAscii + Asc("A") - Asc("a")
End If
If .SelStart < .MaxLength Then
.SelLength = 1
.SelText = Chr$(KeyAscii)
End If
End If
KeyAscii = 0
.SelLength = 0
End With
End Sub
Private Sub txtSCAC_KeyPress(KeyAscii As Integer)
With txtSCAC
If KeyAscii = vbKeyUp Or KeyAscii = vbKeyDown Or KeyAscii = vbKeyRight Or KeyAscii = vbKeyLeft Or KeyAscii = vbKeyEnd Or KeyAscii = vbKeyHome Or KeyAscii = vbKeyPageDown Or KeyAscii = vbKeyPageUp Then
Exit Sub
End If
If KeyAscii = vbKeyBack Then
KeyAscii = 0
If .SelStart <> 0 Then
.SelStart = .SelStart - 1
.SelLength = 1
.SelText = "F"
.SelStart = .SelStart - 1
End If
ElseIf (KeyAscii >= Asc("0") And KeyAscii <= Asc("9")) _
Or (KeyAscii >= Asc("A") And KeyAscii <= Asc("F")) _
Or (KeyAscii >= Asc("a") And KeyAscii <= Asc("f")) Then
'大小写转换
If KeyAscii >= Asc("a") And KeyAscii <= Asc("f") Then
KeyAscii = KeyAscii + Asc("A") - Asc("a")
End If
If .SelStart < .MaxLength Then
.SelLength = 1
.SelText = Chr$(KeyAscii)
End If
End If
KeyAscii = 0
.SelLength = 0
End With
End Sub
Private Sub txtSCX_KeyPress(KeyAscii As Integer)
With txtSCX
If KeyAscii = vbKeyUp Or KeyAscii = vbKeyDown Or KeyAscii = vbKeyRight Or KeyAscii = vbKeyLeft Or KeyAscii = vbKeyEnd Or KeyAscii = vbKeyHome Or KeyAscii = vbKeyPageDown Or KeyAscii = vbKeyPageUp Then
Exit Sub
End If
If KeyAscii = vbKeyBack Then
KeyAscii = 0
If .SelStart <> 0 Then
.SelStart = .SelStart - 1
.SelLength = 1
.SelText = "F"
.SelStart = .SelStart - 1
End If
ElseIf (KeyAscii >= Asc("0") And KeyAscii <= Asc("9")) _
Or (KeyAscii >= Asc("A") And KeyAscii <= Asc("F")) _
Or (KeyAscii >= Asc("a") And KeyAscii <= Asc("f")) Then
'大小写转换
If KeyAscii >= Asc("a") And KeyAscii <= Asc("f") Then
KeyAscii = KeyAscii + Asc("A") - Asc("a")
End If
If .SelStart < .MaxLength Then
.SelLength = 1
.SelText = Chr$(KeyAscii)
End If
End If
KeyAscii = 0
.SelLength = 0
End With
End Sub
Private Sub txtSXAC_KeyPress(KeyAscii As Integer)
With txtSXAC
If KeyAscii = vbKeyUp Or KeyAscii = vbKeyDown Or KeyAscii = vbKeyRight Or KeyAscii = vbKeyLeft Or KeyAscii = vbKeyEnd Or KeyAscii = vbKeyHome Or KeyAscii = vbKeyPageDown Or KeyAscii = vbKeyPageUp Then
Exit Sub
End If
If KeyAscii = vbKeyBack Then
KeyAscii = 0
If .SelStart <> 0 Then
.SelStart = .SelStart - 1
.SelLength = 1
.SelText = "F"
.SelStart = .SelStart - 1
End If
ElseIf (KeyAscii >= Asc("0") And KeyAscii <= Asc("9")) _
Or (KeyAscii >= Asc("A") And KeyAscii <= Asc("F")) _
Or (KeyAscii >= Asc("a") And KeyAscii <= Asc("f")) Then
'大小写转换
If KeyAscii >= Asc("a") And KeyAscii <= Asc("f") Then
KeyAscii = KeyAscii + Asc("A") - Asc("a")
End If
If .SelStart < .MaxLength Then
.SelLength = 1
.SelText = Chr$(KeyAscii)
End If
End If
KeyAscii = 0
.SelLength = 0
End With
End Sub
Private Sub txtVerifyEX_Click()
If cmbDataBuf.ListIndex < 0 Then Exit Sub
Dim buf(128) As Byte
Dim hr As Long
SCHelp_HexStringToBytes txtECX.Text, buf(0), 2
Select Case cmbDataBuf.ListIndex
Case 0
hr = SC1604_Verify(hPort, SC1604ZONE_EZ1, buf(0), buf(1))
Case 1
hr = SC1604_Verify(hPort, SC1604ZONE_EZ2, buf(0), buf(1))
Case 2
hr = SC1604_Verify(hPort, SC1604ZONE_EZ3, buf(0), buf(1))
Case 3
hr = SC1604_Verify(hPort, SC1604ZONE_EZ4, buf(0), buf(1))
End Select
If hr <> 0 Then
MsgBox "校验成功!"
Else
ReportError
End If
Select Case cmbDataBuf.ListIndex
Case 0
hr = SC1604_ReadZone(hPort, SC1604ZONE_E1AC, 0, buf(0), 1)
Case 1
hr = SC1604_ReadZone(hPort, SC1604ZONE_E2AC, 0, buf(0), 1)
Case 2
hr = SC1604_ReadZone(hPort, SC1604ZONE_E3AC, 0, buf(0), 1)
Case 3
hr = SC1604_ReadZone(hPort, SC1604ZONE_E4AC, 0, buf(0), 1)
End Select
If hr <> 0 Then
Dim strHex As String
strHex = Space(2)
SCHelp_BytesToHexString buf(0), 1, strHex
txtEXAC.Text = strHex
End If
End Sub
Private Sub txtVerifySX_Click()
If cmbDataBuf.ListIndex < 0 Then Exit Sub
Dim buf(128) As Byte
Dim hr As Long
SCHelp_HexStringToBytes txtSCX.Text, buf(0), 2
Select Case cmbDataBuf.ListIndex
Case 0
hr = SC1604_Verify(hPort, SC1604ZONE_SC1, buf(0), buf(1))
Case 1
hr = SC1604_Verify(hPort, SC1604ZONE_SC2, buf(0), buf(1))
Case 2
hr = SC1604_Verify(hPort, SC1604ZONE_SC3, buf(0), buf(1))
Case 3
hr = SC1604_Verify(hPort, SC1604ZONE_SC4, buf(0), buf(1))
End Select
If hr <> 0 Then
MsgBox "校验成功!"
Else
ReportError
End If
Select Case cmbDataBuf.ListIndex
Case 0
hr = SC1604_ReadZone(hPort, SC1604ZONE_S1AC, 0, buf(0), 1)
Case 1
hr = SC1604_ReadZone(hPort, SC1604ZONE_S2AC, 0, buf(0), 1)
Case 2
hr = SC1604_ReadZone(hPort, SC1604ZONE_S3AC, 0, buf(0), 1)
Case 3
hr = SC1604_ReadZone(hPort, SC1604ZONE_S4AC, 0, buf(0), 1)
End Select
If hr <> 0 Then
Dim strHex As String
strHex = Space(2)
SCHelp_BytesToHexString buf(0), 1, strHex
txtSXAC.Text = strHex
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -