📄 frmst176.frm
字号:
Index = 5
Left = 120
TabIndex = 50
Top = 720
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "block8"
Height = 180
Index = 7
Left = 120
TabIndex = 49
Top = 1140
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "block10"
Height = 180
Index = 9
Left = 120
TabIndex = 48
Top = 1560
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "block4"
Height = 180
Index = 15
Left = 120
TabIndex = 47
Top = 300
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "block15"
ForeColor = &H000000FF&
Height = 180
Index = 14
Left = 2040
TabIndex = 46
Top = 2400
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "block13"
Height = 180
Index = 12
Left = 2040
TabIndex = 45
Top = 1980
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "block11"
Height = 180
Index = 10
Left = 2040
TabIndex = 44
Top = 1560
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "block9"
Height = 180
Index = 8
Left = 2040
TabIndex = 42
Top = 1140
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "block7"
Height = 180
Index = 6
Left = 2040
TabIndex = 41
Top = 720
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "block5"
Height = 180
Index = 4
Left = 2040
TabIndex = 40
Top = 300
Width = 540
End
End
Begin VB.Frame Frame1
Caption = "Card Serial Number(ROM)"
Enabled = 0 'False
Height = 795
Left = 180
TabIndex = 34
Top = 120
Width = 7935
Begin VB.TextBox txtSector
Height = 315
Index = 3
Left = 6720
Locked = -1 'True
MaxLength = 4
TabIndex = 3
Text = "FFFF"
Top = 300
Width = 1035
End
Begin VB.TextBox txtSector
Height = 315
Index = 2
Left = 4800
Locked = -1 'True
MaxLength = 4
TabIndex = 2
Text = "FFFF"
Top = 300
Width = 1035
End
Begin VB.TextBox txtSector
Height = 315
Index = 1
Left = 2820
Locked = -1 'True
MaxLength = 4
TabIndex = 1
Text = "FFFF"
Top = 300
Width = 1035
End
Begin VB.TextBox txtSector
Height = 315
Index = 0
Left = 900
Locked = -1 'True
MaxLength = 4
TabIndex = 0
Text = "FFFF"
Top = 300
Width = 1035
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "block3"
Height = 180
Index = 3
Left = 6120
TabIndex = 38
Top = 360
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "block2"
Height = 180
Index = 2
Left = 4080
TabIndex = 37
Top = 360
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "block1"
Height = 180
Index = 1
Left = 2100
TabIndex = 36
Top = 360
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "block0"
Height = 180
Index = 0
Left = 180
TabIndex = 35
Top = 360
Width = 540
End
End
End
Attribute VB_Name = "frmST176"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub btnCancel_Click()
Unload Me
End Sub
Private Sub btnLock_Click(index As Integer)
If Not OpenDevice Then
MsgBox "Device is not ready!"
Exit Sub
End If
If Not ProtectCard(index + 2) Then
CloseDevice
MsgBox "Lock EEPROM Failed!"
Exit Sub
End If
CloseDevice
MsgBox "Lock EEPROM OK!"
End Sub
Private Sub btnRead_Click(index As Integer)
If Not OpenDevice Then
MsgBox "Device is not ready!"
Exit Sub
End If
Dim I As Byte
Dim val0 As Byte
Dim val1 As Byte
For I = (index + 2) * 2 To (index + 2) * 2 + 1
If ReadCard(I, val0, val1) Then
txtSector(I).Text = ToHexString(val0) & ToHexString(val1)
Else
CloseDevice
MsgBox "Read block " & I & " failed!"
Exit Sub
End If
Next
CloseDevice
MsgBox "Read OK!"
End Sub
Private Sub btnWrite_Click(index As Integer)
If Not OpenDevice Then
MsgBox "Device is not ready!"
Exit Sub
End If
If Not WriteBlock((index + 2) * 2) Then Exit Sub
If (index + 2) * 2 + 1 <> 15 Then
If Not WriteBlock((index + 2) * 2 + 1) Then Exit Sub
End If
CloseDevice
MsgBox "Write OK!"
End Sub
Private Sub btnReadAll_Click()
If Not OpenDevice Then
MsgBox "Device is not ready!"
Exit Sub
End If
Dim I As Byte
Dim val0 As Byte
Dim val1 As Byte
For I = 0 To 15
If ReadCard(I, val0, val1) Then
txtSector(I).Text = ToHexString(val0) & ToHexString(val1)
Else
CloseDevice
MsgBox "Read block " & I & " failed!"
Exit Sub
End If
Next
CloseDevice
MsgBox "Read OK!"
End Sub
Function WriteBlock(ByVal index As Byte) As Boolean
If Not WriteCard(index, ToByte(Left$(txtSector(index).Text, 2)), ToByte(Right$(txtSector(index).Text, 2))) Then
CloseDevice
MsgBox "Write block " & index & " failed!"
WriteBlock = False
Exit Function
End If
WriteBlock = True
End Function
Private Sub Form_Unload(Cancel As Integer)
CloseDevice
End Sub
Private Sub txtSector_KeyDown(index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyDelete Then
KeyCode = 0
End If
End Sub
Private Sub txtSector_KeyPress(index As Integer, KeyAscii As Integer)
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 txtSector(index).SelStart <> 0 Then
txtSector(index).SelStart = txtSector(index).SelStart - 1
txtSector(index).SelLength = 1
txtSector(index).SelText = "F"
txtSector(index).SelStart = txtSector(index).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 txtSector(index).SelStart < txtSector(index).MaxLength Then
txtSector(index).SelLength = 1
txtSector(index).SelText = Chr$(KeyAscii)
End If
End If
KeyAscii = 0
txtSector(index).SelLength = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -