⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmwrite.frm

📁 利用连接mg500读卡器进行卡片是否完好的检测程序
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      MaxLength       =   1
      TabIndex        =   10
      Top             =   240
      Width           =   375
   End
   Begin VB.TextBox Texttext 
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   4
      Left            =   2280
      MaxLength       =   1
      TabIndex        =   9
      Top             =   240
      Width           =   375
   End
   Begin VB.TextBox Texttext 
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   3
      Left            =   1920
      MaxLength       =   1
      TabIndex        =   8
      Top             =   240
      Width           =   375
   End
   Begin VB.TextBox Texttext 
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   2
      Left            =   1560
      MaxLength       =   1
      TabIndex        =   7
      Top             =   240
      Width           =   375
   End
   Begin VB.TextBox Texttext 
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   1
      Left            =   1200
      MaxLength       =   1
      TabIndex        =   6
      Top             =   240
      Width           =   375
   End
   Begin VB.TextBox Texttext 
      DataField       =   "2"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   0
      Left            =   840
      MaxLength       =   1
      TabIndex        =   2
      Top             =   240
      Width           =   375
   End
   Begin VB.CommandButton CancelButton 
      BackColor       =   &H00C0C000&
      Caption         =   "Exit"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4680
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   2760
      Width           =   1215
   End
   Begin VB.CommandButton cmdwritedata 
      BackColor       =   &H00C0C000&
      Caption         =   "Write"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2640
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   2760
      Width           =   1215
   End
   Begin VB.Label Label4 
      BackColor       =   &H00FFC0C0&
      Caption         =   "Status"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1320
      TabIndex        =   40
      Top             =   2040
      Width           =   735
   End
   Begin VB.Label Label3 
      BackColor       =   &H00FFC0C0&
      Caption         =   "Value"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   240
      TabIndex        =   5
      Top             =   1560
      Width           =   615
   End
   Begin VB.Label Label2 
      BackColor       =   &H00FFC0C0&
      Caption         =   "Hex"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   240
      TabIndex        =   4
      Top             =   960
      Width           =   495
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0C0&
      Caption         =   "Text"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   240
      TabIndex        =   3
      Top             =   360
      Width           =   495
   End
End
Attribute VB_Name = "frmwrite"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit

Private Sub CancelButton_Click()
    frmwrite.Hide
    Demokit.Enabled = True
End Sub

Private Sub CmdClear_Click()
    Dim i As Integer
    
    For i = 0 To 15
        Texttext(i).Text = ""
        Texthex(i).Text = ""
    Next i
    Textvalue.Text = ""
    Textstatus.Text = ""
    
End Sub

Private Sub cmdwritedata_Click()
    Dim datastring(0 To 15, 0) As Byte
    Dim i As Integer
    Dim datastr(0 To 15) As Byte
    
    For i = 0 To 15
        If Texthex(i).Text = "" Then
            datastring(i, 0) = "&h00"
        Else
            datastring(i, 0) = "&H" & Texthex(i).Text
        End If
    Next i
    If Blockstatus = 0 Then
        Textstatus.Text = "Block 0 can't write"
        Exit Sub
    End If
    
    Call ReqtoAuthen(Blockstatus / 4)   'Sector
    If MifStatus <> 0 Then
        Textstatus.Text = "Write -> Error"
        Exit Sub
    End If

    MifStatus = mifsw_write%(Blockstatus, datastring(0, 0))
    If MifStatus <> 0 Then
        Textstatus.Text = "Write -> Error"
    Else
        Textstatus.Text = "Write -> Ok"
    End If
End Sub

Private Sub Commandvalue_Click()
    Dim data As Integer
    Dim data1 As Integer
    Dim i As Integer
    
    data = Textvalue.Text
    data1 = 100
    For i = 0 To 3
       If data1 > 0 Then
         If (data \ 256) > 0 Then
            If data - (data \ 256) * 256 >= 16 Then
                Texthex(i).Text = Hex(data - (data \ 256) * 256)
                Texthex(i + 8).Text = Hex(data - (data \ 256) * 256)
            Else
                Texthex(i).Text = "0" & Hex(data - (data \ 256) * 256)
                Texthex(i + 8).Text = "0" & Hex(data - (data \ 256) * 256)
            End If
            If 255 - (data - (data \ 256) * 256) >= 16 Then
                Texthex(i + 4).Text = Hex(255 - (data - (data \ 256) * 256))
            Else
                If Hex(255 - (data - (data \ 256) * 256)) = 0 Then
                    Texthex(i + 4).Text = "00"
                Else
                    Texthex(i + 4).Text = "0" & Hex(255 - (data - (data \ 256) * 256))
                End If
            End If
            data = data \ 256
          
          Else
            If data - (data \ 256) * 256 >= 16 Then
                Texthex(i).Text = Hex(data - (data \ 256) * 256)
                Texthex(i + 8).Text = Hex(data - (data \ 256) * 256)
            Else
                Texthex(i).Text = "0" & Hex(data - (data \ 256) * 256)
                Texthex(i + 8).Text = "0" & Hex(data - (data \ 256) * 256)
            End If
            If 255 - (data - (data \ 256) * 256) >= 16 Then
                Texthex(i + 4).Text = Hex(255 - (data - (data \ 256) * 256))
            Else
                If Hex(255 - (data - (data \ 256) * 256)) = 0 Then
                    Texthex(i + 4).Text = "00"
                Else
                    Texthex(i + 4).Text = "0" & Hex(256 - (data - (data \ 256) * 256))
                End If

            End If
            data = data \ 256
            data1 = 0
         End If
       Else
         Texthex(i + 4).Text = "FF"
         Texthex(i).Text = "00"
         Texthex(i + 8).Text = "00"
       End If
    Next i
    Texthex(12).Text = "FF"
    Texthex(13).Text = "00"
    Texthex(14).Text = "FF"
    Texthex(15).Text = "00"
    Textstatus.Text = "Value Prepare -> Ok"
End Sub

Private Sub Texthex_KeyPress(Index As Integer, KeyAscii As Integer)
    If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then
        If KeyAscii < Asc("a") Or KeyAscii > Asc("f") Then
            If KeyAscii < Asc("A") Or KeyAscii > Asc("F") Then
                KeyAscii = 0
            End If
        End If
    End If
End Sub

Private Sub Texttext_Change(Index As Integer)
If Texttext(Index) = "" Then
    Texthex(Index) = &H0
Else
    Texthex(Index) = Hex(Asc(Texttext(Index).Text))
End If
End Sub

Private Sub ReqtoAuthen(ByVal SecNr)
    
    Call modestatus(modestring)
    
    MifStatus = mifsw_request_2%(mode, tagtype)  'request mode= 1
    If MifStatus <> 0 Then
    MifStatus = mifsw_request_2%(mode, tagtype)
    If MifStatus <> 0 Then
              MsgBox "Request Error, " + CStr(MifStatus)
              Exit Sub
          End If
    End If

    MifStatus = mifsw_anticoll%(mode, snr)
    If MifStatus <> 0 Then
        MsgBox "Anticollision Error, " + CStr(MifStatus)
        Exit Sub
    End If
    
    MifStatus = mifsw_select%(snr, Size(0))
    If MifStatus <> 0 Then
        MsgBox "Select Error, " + CStr(MifStatus)
        Exit Sub
    End If
    
    MifStatus = mifsw_authentication%(mode, SecNr)     'mode=0, SecNr
    If MifStatus <> 0 Then
        Textstatus.Text = Textstatus.Text & "Authentication Error " & Chr(10)
        Exit Sub
    End If
    
End Sub

Private Sub modestatus(p As String)
    
    If mode = 0 Then
        p = "    (KeyA KeySet0)"
    Else
        If mode = 1 Then
            p = "    (KeyA KeySet1)"
        Else
            If mode = 2 Then
                p = "    (KeyA KeySet2)"
            Else
                If mode = 4 Then
                    p = "    (KeyB KeySet0)"
                Else
                    If mode = 5 Then
                        p = "    (KeyB KeySet1)"
                    Else
                        If mode = 6 Then
                            p = "    (KeyB KeySet2)"
                        End If
                    End If
                End If
            End If
        End If
    End If
End Sub



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -