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

📄 form11.frm

📁 基于VB的非接触IC卡应用
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   5760
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7320
   LinkTopic       =   "Form1"
   Picture         =   "Form11.frx":0000
   ScaleHeight     =   5760
   ScaleWidth      =   7320
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton keyauthen 
      Caption         =   "密码认证"
      Height          =   495
      Left            =   2520
      TabIndex        =   13
      Top             =   4560
      Width           =   975
   End
   Begin VB.CommandButton loadkey 
      Caption         =   "下载密码"
      Height          =   495
      Left            =   1560
      TabIndex        =   12
      Top             =   4560
      Width           =   975
   End
   Begin VB.CommandButton selectcard 
      Caption         =   "激活卡"
      Height          =   495
      Left            =   600
      TabIndex        =   11
      Top             =   4560
      Width           =   975
   End
   Begin VB.CommandButton readcard 
      Caption         =   "读卡号"
      Height          =   495
      Left            =   3480
      TabIndex        =   10
      Top             =   4080
      Width           =   975
   End
   Begin VB.CommandButton callcard 
      Caption         =   "呼叫卡"
      Height          =   495
      Left            =   2520
      TabIndex        =   9
      Top             =   4080
      Width           =   975
   End
   Begin VB.CommandButton driver 
      Caption         =   "灯控"
      Height          =   495
      Left            =   3480
      TabIndex        =   8
      Top             =   3600
      Width           =   975
   End
   Begin VB.CommandButton readver 
      Caption         =   "读版本号"
      Height          =   495
      Left            =   1560
      TabIndex        =   7
      Top             =   4080
      Width           =   975
   End
   Begin VB.CommandButton wizap 
      Caption         =   "断开连接"
      Height          =   495
      Left            =   600
      TabIndex        =   6
      Top             =   4080
      Width           =   975
   End
   Begin VB.CommandButton EXITT 
      Caption         =   "退出"
      Height          =   495
      Left            =   2520
      TabIndex        =   5
      Top             =   3600
      Width           =   975
   End
   Begin VB.CommandButton lianjie 
      Caption         =   "连接"
      Height          =   495
      Left            =   1560
      TabIndex        =   4
      Top             =   3600
      Width           =   975
   End
   Begin VB.CommandButton clear 
      Caption         =   "清屏"
      Height          =   495
      Left            =   600
      TabIndex        =   3
      Top             =   3600
      Width           =   975
   End
   Begin VB.ListBox List1 
      Height          =   1860
      ItemData        =   "Form11.frx":0342
      Left            =   600
      List            =   "Form11.frx":0344
      TabIndex        =   2
      Top             =   1440
      Width           =   4695
   End
   Begin VB.TextBox Text1 
      Height          =   735
      Left            =   2880
      TabIndex        =   1
      Top             =   480
      Width           =   2415
   End
   Begin VB.Frame Frame1 
      Caption         =   "卡片序列号"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   600
      TabIndex        =   0
      Top             =   480
      Width           =   1815
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim flag As Integer
Dim status As Long
Dim i As Long
Dim ReadBuff(16) As Byte
Dim wtdata As String * 32

Private Sub Label1_Click()

End Sub

Private Sub callcard_Click()
callmode.Show 1
If ans = 0 Then
  List1.AddItem "请重新输入命令!"
  Exit Sub
End If
If ycallmode = 2 Then
  List1.clear
  List1.AddItem "呼叫操作取消!"
  Exit Sub
End If
status = RFMifare_Request(ycallmode, cdtype)
'List1.clear
List1.AddItem "  "
If status = 0 Then
  If cdtype = 4 Then
      List1.AddItem "  呼叫成功!"
  End If
Else
   List1.AddItem "呼叫失败"
End If
   
   
End Sub

Private Sub clear_Click()
    MousePointer = 99
    List1.clear

    MousePointer = 0
End Sub



Private Sub Command3_Click()

End Sub

Private Sub Command4_Click()

End Sub

Private Sub driver_Click()
   Dim mode As Long
   Dim actiontime As Long
   Dim intervaltime As Long
   Dim count As Long
   
   MousePointer = 99
   mode = 7
   actiontime = 30
   intervaltime = 30
   count = 3
   
  status = ALARM(mode, actiontime, intervaltime, count)
If status = 0 Then
   List1.clear
   List1.AddItem " "
   List1.AddItem "灯控成功!"
  Else
   List1.AddItem ""
   List1.AddItem "灯控失败!"
End If
MousePointer = 0

   
End Sub

Private Sub EXITT_Click()

On Error Resume Next
End

End Sub

Private Sub Form_Load()
driver.Enabled = False
wizap.Enabled = False
readver.Enabled = False
callcard.Enabled = False
readcard.Enabled = False
selectcard.Enabled = False
loadkey.Enabled = False
keyauthen.Enabled = False
End Sub

Private Sub keyauthen_Click()
Dim mode As Long
Dim sector As Long
Dim blockno As Long
mimaflag = 0
If cdtype = 4 Then
  mimaflag = 0
  mima.Show 1
  If ans = 0 Then
    List1.AddItem "请重新输入命令!"
    Exit Sub
  End If
  cdpage = datasector
  mode = mimanum
  mode = mode * 4
  If mimanum = 2 Then
     List1.clear
     List1.AddItem "密码输入错误!"
     Exit Sub
  End If
  blockno = (datasector + 1) * 4 - 1
  status = RFMifare_Authentication(mode, cdpage, blockno)
'Else
 ' mimaflag = 1
  'mima.Show 1
  'If ans = 0 Then
  'List1.AddItem "请重新输入命令!"
  'Exit Sub
  'End If
  'mode = datasector
  'If mode = 0 Then
  'blockno = 6
  'Else
  'blockno = 8
  'End If
  'status = RFMifare_Authentication(mode, 0, blockno)
  End If
  List1.clear
  List1.AddItem ""
  If status = 0 Then
    List1.AddItem "密码认证通过"
  Else
    List1.AddItem "密码认证未通过"
  End If
End Sub

Private Sub lianjie_Click()
    Dim Port As Long
    Dim mcmno As Long
    status = AutoLinkCom(Port)
    List1.AddItem "   "
    If status = 0 Then
    status = RFMifare_Mcmno(mcmno)
    If mcmno = 17 Then
    List1.AddItem "系统与CE06 MIFARE读写器连接成功!"
    driver.Enabled = True
 
    wizap.Enabled = True
    readver.Enabled = True
    callcard.Enabled = True
    readcard.Enabled = True
    selectcard.Enabled = True
    loadkey.Enabled = True
    keyauthen.Enabled = True
    Else
    List1.AddItem "系统连接的不是CE06 MIFARE读写器,请重新连接!"
    End If
    Else
    List1.AddItem "通信口连接失败!请检查MF读写器连接是否正常!"
    End If
    
    
    
End Sub

Private Sub loadkey_Click()
Dim ymima(6) As Byte
Dim mode As Long
If cdtype = 4 Then
  mimaflag = 1
  mima.Show 1
  If ans = 0 Then
      List1.AddItem "请重新输入命令!"
      Exit Sub
  End If
  cdpage = datasector
  mode = mimanum
  mode = mode * 4
  For i = 0 To 5
      ymima(i) = Val("&H" + Mid(Trim(mimacode), i * 2 + 1, 2))
     ' MsgBox ymima(i) & "source:" & mimacode
      
  Next i
  status = RFMifare_LoadKey(mode, cdpage, ymima(0))
  List1.clear
  List1.AddItem ""
    If status = 0 Then
     List1.AddItem "密码传送成功!"
    Else
      List1.AddItem "密码传送失败!"
    End If
End If
End Sub

Private Sub readcard_Click()
Dim temp As String
Dim j As Integer
MousePointer = 99
List1.clear
List1.AddItem ""
status = RFMifare_AntiColl(cdsnr)
If status = 0 Then
    List1.AddItem "读卡片序列号成功!"
    temp = "000000" + Hex(cdsnr)
    j = Len(temp)
    'cardno = Mid(temp, j - 7, 8)
    List1.AddItem cdsnr
Else
      List1.AddItem "读取序列号失败!"
      'cardno = ""
End If
MousePointer = 0

End Sub

Private Sub readver_Click()
   Dim mcmver(20) As Byte
   Dim temp As String
   Dim i As Byte
   MousePointer = 99
   status = DEVVER(mcmver(0))
   If status = 0 Then
      List1.clear
      List1.AddItem " "
      List1.AddItem "读控制软件版本号成功!"
      temp = " "
      For i = 0 To 7
      temp = temp + Hex(mcmver(i))
      Next
      List1.AddItem temp
    Else
      List1.AddItem ""
      List1.AddItem "读控制软件版本号失败!"
    End If
      MousePointer = 0
      

End Sub

Private Sub selectcard_Click()
status = RFMifare_Select(cdsnr)
List1.clear
List1.AddItem ""
If status = 0 Then
   List1.AddItem "卡激活成功!"
 Else
  List1.AddItem "卡激活失败!"
  End If
  
End Sub

Private Sub wizap_Click()
MousePointer = 99
status = UnLinkCom()
If status = 0 Then
List1.clear
List1.AddItem " "
List1.AddItem "断开连接成功!"
driver.Enabled = False
wizap.Enabled = False
readver.Enabled = False
callcard.Enabled = False
readcard.Enabled = False
selectcard.Enabled = False
loadkey.Enabled = False
keyauthen.Enabled = False

Else
List1.clear
List1.AddItem " "
List1.AddItem "断开连接失败!"
End If
MousePointer = 0


End Sub

⌨️ 快捷键说明

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