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

📄 frmmian.frm

📁 风靡全球的非接触IC卡(即感应卡)的应用越来越广泛
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmMian 
   Caption         =   "Mifare Dll Test"
   ClientHeight    =   7680
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6270
   LinkTopic       =   "Form1"
   ScaleHeight     =   7680
   ScaleWidth      =   6270
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox txtReturn 
      Height          =   270
      Left            =   960
      TabIndex        =   19
      Top             =   1200
      Width           =   735
   End
   Begin VB.CommandButton cmdClear 
      Caption         =   "Clear"
      Height          =   375
      Left            =   1920
      TabIndex        =   18
      Top             =   1080
      Width           =   1455
   End
   Begin VB.Frame frameMenu 
      Height          =   7575
      Left            =   3720
      TabIndex        =   4
      Top             =   120
      Width           =   2415
      Begin VB.CommandButton cmdMif 
         Caption         =   "Mif_Authentication"
         Height          =   375
         Index           =   5
         Left            =   120
         TabIndex        =   21
         Top             =   2680
         Width           =   2175
      End
      Begin VB.CommandButton cmdMif 
         Caption         =   "Mif_Load_Key"
         Height          =   375
         Index           =   0
         Left            =   120
         TabIndex        =   20
         Top             =   240
         Width           =   2175
      End
      Begin VB.CommandButton cmdMif 
         Caption         =   "Mif_Halt"
         Height          =   375
         Index           =   14
         Left            =   120
         TabIndex        =   17
         Top             =   7080
         Width           =   2175
      End
      Begin VB.CommandButton cmdMif 
         Caption         =   "Mif_Transfer"
         Height          =   375
         Index           =   13
         Left            =   120
         TabIndex        =   16
         Top             =   6584
         Width           =   2175
      End
      Begin VB.CommandButton cmdMif 
         Caption         =   "Mif_Restore"
         Height          =   375
         Index           =   12
         Left            =   120
         TabIndex        =   15
         Top             =   6096
         Width           =   2175
      End
      Begin VB.CommandButton cmdMif 
         Caption         =   "Mif_Decrement"
         Height          =   375
         Index           =   11
         Left            =   120
         TabIndex        =   14
         Top             =   5608
         Width           =   2175
      End
      Begin VB.CommandButton cmdMif 
         Caption         =   "Mif_Increment"
         Height          =   375
         Index           =   10
         Left            =   120
         TabIndex        =   13
         Top             =   5120
         Width           =   2175
      End
      Begin VB.CommandButton cmdMif 
         Caption         =   "Mif_Initval"
         Height          =   375
         Index           =   9
         Left            =   120
         TabIndex        =   12
         Top             =   4632
         Width           =   2175
      End
      Begin VB.CommandButton cmdMif 
         Caption         =   "Mif_Write"
         Height          =   375
         Index           =   8
         Left            =   120
         TabIndex        =   11
         Top             =   4144
         Width           =   2175
      End
      Begin VB.CommandButton cmdMif 
         Caption         =   "Mif_Read_Val"
         Height          =   375
         Index           =   7
         Left            =   120
         TabIndex        =   10
         Top             =   3656
         Width           =   2175
      End
      Begin VB.CommandButton cmdMif 
         Caption         =   "Mif_Read"
         Height          =   375
         Index           =   6
         Left            =   120
         TabIndex        =   9
         Top             =   3168
         Width           =   2175
      End
      Begin VB.CommandButton cmdMif 
         Caption         =   "Mif_Select"
         Height          =   375
         Index           =   4
         Left            =   120
         TabIndex        =   8
         Top             =   2192
         Width           =   2175
      End
      Begin VB.CommandButton cmdMif 
         Caption         =   "Mif_Anticoll"
         Height          =   375
         Index           =   3
         Left            =   120
         TabIndex        =   7
         Top             =   1704
         Width           =   2175
      End
      Begin VB.CommandButton cmdMif 
         Caption         =   "Mif_Request_2"
         Height          =   375
         Index           =   2
         Left            =   120
         TabIndex        =   6
         Top             =   1216
         Width           =   2175
      End
      Begin VB.CommandButton cmdMif 
         Caption         =   "Mif_Reset"
         Height          =   375
         Index           =   1
         Left            =   120
         TabIndex        =   5
         Top             =   728
         Width           =   2175
      End
   End
   Begin VB.TextBox txtReceive 
      Height          =   1455
      Left            =   120
      TabIndex        =   1
      Top             =   1560
      Width           =   3375
   End
   Begin VB.TextBox txtSend 
      Height          =   375
      Left            =   120
      TabIndex        =   0
      Top             =   600
      Width           =   3375
   End
   Begin VB.Label lblReceive 
      Caption         =   "Receive:"
      Height          =   375
      Left            =   120
      TabIndex        =   3
      Top             =   1200
      Width           =   1095
   End
   Begin VB.Label lblSend 
      Caption         =   "Send:"
      Height          =   375
      Left            =   120
      TabIndex        =   2
      Top             =   240
      Width           =   1215
   End
End
Attribute VB_Name = "frmMian"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Const cMIF_LOAD_KEY = &H0
Const cMIF_RESET = &H1
Const cMIF_REQUEST_2 = &H2
Const cMIF_ANTICOLL = &H3
Const cMIF_SELECT = &H4
Const cMIF_AUTHENTICATION = &H5
Const cMIF_READ = &H6
Const cMIF_READ_VAL = &H7
Const cMIF_WRITE = &H8
Const cMIF_INIT_VAL = &H9
Const cMIF_INCREMENT = &HA
Const cMIF_DECREMENT = &HB
Const cMIF_RESTORE = &HC
Const cMIF_TRANSFER = &HD
Const cMIF_HALT = &HE

Const cMIF_CHECK_WRITE = &HF

Const IDLE = 0
Const ALL = 1
Dim nRet As Integer
Dim tt As Integer
Dim i As Integer
Dim nSnr As Long
Dim nSize As Byte
Dim readdata As String * 32
Dim writedata As String * 32
Dim nValue As Long
Private Sub cmdClear_Click()
    txtReceive.Text = ""
End Sub
Private Sub cmdMif_Click(Index As Integer)
    Select Case Index
        Case cMIF_ANTICOLL
            nSnr = 0
            nRet = mif_anticoll(0, nSnr)
            txtReceive.Text = Hex(nSnr)
        Case cMIF_SELECT
            nSize = 0
            nRet = mif_select(nSnr, nSize)
            txtReceive.Text = Hex(nSize)
        Case cMIF_LOAD_KEY
            nRet = mif_load_key(0, 0, "bdde6f378383", "a0a1a2a3a4a5")
            nRet = mif_load_key(0, 1, "148ac5e22828", "a0a1a2a3a4a5")
            nRet = mif_load_key(0, 2, "7d3e9f4f9595", "a0a1a2a3a4a5")
            nRet = mif_load_key(0, 3, "add66b35c8c8", "a0a1a2a3a4a5")
            nRet = mif_load_key(0, 4, "dfef77bbe4e4", "a0a1a2a3a4a5")
            nRet = mif_load_key(0, 5, "09844221bcbc", "a0a1a2a3a4a5")
            nRet = mif_load_key(0, 6, "5fafd7eba5a5", "a0a1a2a3a4a5")
            nRet = mif_load_key(0, 7, "29148ac59f9f", "a0a1a2a3a4a5")
            nRet = mif_load_key(0, 8, "fafdfe7fffff", "197408221248")
            nRet = mif_load_key(0, 9, "73399ccebebe", "197408221248")
            nRet = mif_load_key(0, 10, "fc7ebfdfbfbf", "197408221248")
            nRet = mif_load_key(0, 11, "cfe773395151", "197408221248")
            nRet = mif_load_key(0, 12, "f7fb7d3e5a5a", "197408221248")
            nRet = mif_load_key(0, 13, "f2793c1e8d8d", "197408221248")
            nRet = mif_load_key(0, 14, "cfe773394545", "197408221248")
            nRet = mif_load_key(0, 15, "b7db6db67d7d", "197408221248")
            
            nRet = mif_load_key(4, 0, "bdde6f378383", "b0b1b2b3b4b5")
            nRet = mif_load_key(4, 1, "148ac5e22828", "b0b1b2b3b4b5")
            nRet = mif_load_key(4, 2, "7d3e9f4f9595", "b0b1b2b3b4b5")
            nRet = mif_load_key(4, 3, "add66b35c8c8", "b0b1b2b3b4b5")
            nRet = mif_load_key(4, 4, "dfef77bbe4e4", "b0b1b2b3b4b5")
            nRet = mif_load_key(4, 5, "09844221bcbc", "b0b1b2b3b4b5")
            nRet = mif_load_key(4, 6, "5fafd7eba5a5", "b0b1b2b3b4b5")
            nRet = mif_load_key(4, 7, "29148ac59f9f", "b0b1b2b3b4b5")
            nRet = mif_load_key(4, 8, "fafdfe7fffff", "197408221248")
            nRet = mif_load_key(4, 9, "73399ccebebe", "197408221248")
            nRet = mif_load_key(4, 10, "fc7ebfdfbfbf", "197408221248")
            nRet = mif_load_key(4, 11, "cfe773395151", "197408221248")
            nRet = mif_load_key(4, 12, "f7fb7d3e5a5a", "197408221248")
            nRet = mif_load_key(4, 13, "f2793c1e8d8d", "197408221248")
            nRet = mif_load_key(4, 14, "cfe773394545", "197408221248")
            nRet = mif_load_key(4, 15, "b7db6db67d7d", "197408221248")
        Case cMIF_AUTHENTICATION
            'nRet = mif_authentication(0, 0)
            nRet = mif_authentication(0, 2)
        Case cMIF_READ
            readdata = ""
            nRet = mif_read(8, readdata)
            txtReceive.Text = readdata
        Case cMIF_READ_VAL
            nRet = mif_read(8, readdata)
            nValue = CharToNum(Mid(readdata, 2, 1)) + _
                    CharToNum(Mid(readdata, 1, 1)) * (2 ^ 4) + _
                    CharToNum(Mid(readdata, 4, 1)) * (2 ^ 8) + _
                    CharToNum(Mid(readdata, 3, 1)) * (2 ^ 12) + _
                    CharToNum(Mid(readdata, 6, 1)) * (2 ^ 16) + _
                    CharToNum(Mid(readdata, 5, 1)) * (2 ^ 20) + _
                    CharToNum(Mid(readdata, 8, 1)) * (2 ^ 24) + _
                    CharToNum(Mid(readdata, 7, 1)) * (2 ^ 28)
            txtReceive.Text = nValue

        Case cMIF_WRITE
            writedata = "000102030405060708090a0b0c0d0e0f"
            readdata = ""
            nRet = mif_write(9, writedata)
            nRet = mif_check_write(nSnr, 4, 9, writedata)
            nRet = mif_read(8, readdata)
        Case cMIF_INIT_VAL
            nRet = mif_initval(8, 15000)
        Case cMIF_INCREMENT
            nRet = mif_increment(8, 10000)
        Case cMIF_DECREMENT
            nRet = mif_decrement(8, 50)
        Case cMIF_RESTORE
            nRet = mif_restore(8)
        Case cMIF_TRANSFER
            nRet = mif_transfer(8)
        Case cMIF_HALT
            nRet = mif_halt()
        Case cMIF_RESET
            nRet = mif_reset(25)
        Case cMIF_REQUEST_2
            tt = 0
            nRet = mif_request_2(ALL, tt)
            txtReceive.Text = tt
    End Select
    txtReturn.Text = nRet
End Sub
Private Sub Form_Load()
    nRet = OpenComm(0)
End Sub
Function CharToNum(inChar As String) As Byte
    Select Case UCase(inChar)
        Case "0" To "9": CharToNum = CByte(inChar)
        Case "A" To "F": CharToNum = Asc(UCase(inChar)) - 55
        Case Else:       CharToNum = 0
    End Select
End Function


⌨️ 快捷键说明

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