📄 frmparity.frm
字号:
VERSION 5.00
Begin VB.Form frmParity
BorderStyle = 3 'Fixed Dialog
Caption = "Parity and Length"
ClientHeight = 1455
ClientLeft = 45
ClientTop = 330
ClientWidth = 6750
Icon = "frmParity.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
ScaleHeight = 1455
ScaleWidth = 6750
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton cmdClear
Caption = "Clear"
Height = 375
Left = 5760
TabIndex = 12
Top = 120
Width = 855
End
Begin VB.CommandButton cmdQuit
Caption = "Quit"
Height = 375
Left = 5760
TabIndex = 8
Top = 980
Width = 855
End
Begin VB.CommandButton cmdCalculate
Caption = "Calculate"
Height = 375
Left = 5760
TabIndex = 6
Top = 550
Width = 855
End
Begin VB.TextBox txtAnswer
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 345
Left = 4680
OLEDragMode = 1 'Automatic
OLEDropMode = 2 'Automatic
TabIndex = 7
Top = 960
Width = 975
End
Begin VB.TextBox txtClientHex
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 345
Left = 600
OLEDragMode = 1 'Automatic
OLEDropMode = 2 'Automatic
TabIndex = 0
Top = 120
Width = 5055
End
Begin VB.Frame Frame1
Caption = "Parity"
Height = 735
Left = 120
TabIndex = 9
Top = 600
Width = 4455
Begin VB.OptionButton optParity
Caption = "Len"
Height = 375
Index = 4
Left = 3720
TabIndex = 5
Top = 240
Width = 615
End
Begin VB.OptionButton optParity
Caption = "Crc"
Height = 375
Index = 2
Left = 1440
TabIndex = 3
Top = 240
Width = 615
End
Begin VB.OptionButton optParity
Caption = "TCP/IP CheckSum"
Height = 375
Index = 3
Left = 2040
TabIndex = 4
Top = 240
Width = 1695
End
Begin VB.OptionButton optParity
Caption = "Add"
Height = 375
Index = 1
Left = 720
TabIndex = 2
Top = 240
Width = 735
End
Begin VB.OptionButton optParity
Caption = "Xor"
Height = 375
Index = 0
Left = 120
TabIndex = 1
Top = 240
Width = 735
End
End
Begin VB.Label Label2
Caption = "Result:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4680
TabIndex = 11
Top = 720
Width = 735
End
Begin VB.Label Label1
Caption = "Hex:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 10
Top = 240
Width = 615
End
End
Attribute VB_Name = "frmParity"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private ParityMark As Integer
Private Sub cmdCalculate_Click()
If txtClientHex.Text = "" Then
MsgBox "Please input some hex string!", vbExclamation + vbOKOnly
Exit Sub
End If
If Len(Trim(txtClientHex.Text)) < 2 Then
MsgBox "Please input more chars!", vbExclamation + vbOKOnly
Exit Sub
End If
Select Case ParityMark
Case 0
txtAnswer.Text = xorStrValue(txtClientHex.Text)
Case 1
txtAnswer.Text = addStrValue(txtClientHex.Text)
Case 2
Dim strTmp As String
strTmp = Trim(txtAnswer.Text)
If Len(strTmp) < 4 Then
strTmp = "FFFF"
Else
strTmp = Mid(strTmp, 1, 4)
End If
txtAnswer.Text = crcStrValue(strTmp, txtClientHex.Text)
Case 3
txtAnswer.Text = addStrBCSValue(txtClientHex.Text)
Case 4
txtAnswer.Text = Len(Trim(txtClientHex.Text)) / 2
End Select
End Sub
Private Sub cmdClear_Click()
txtClientHex.Text = ""
txtAnswer.Text = ""
End Sub
Private Sub Form_Load()
'Call SetForm(Me, 500, 700)
SetWindowPos frmParity.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
txtAnswer.Text = ""
txtClientHex.Text = ""
ParityMark = 0
optParity(0).Value = True
End Sub
Private Sub optParity_Click(Index As Integer)
ParityMark = Index
End Sub
Private Sub cmdQuit_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -