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

📄 form1.frm

📁 接触式IC卡的上电
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   6480
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   8805
   LinkTopic       =   "Form1"
   ScaleHeight     =   6480
   ScaleWidth      =   8805
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Comclear 
      Caption         =   "输入密码"
      Height          =   495
      Left            =   3840
      TabIndex        =   20
      Top             =   4920
      Width           =   1095
   End
   Begin VB.TextBox txtpw 
      Height          =   495
      Left            =   5280
      TabIndex        =   18
      Top             =   4200
      Width           =   1815
   End
   Begin VB.CommandButton Comcount 
      Caption         =   "读错误计数器"
      CausesValidation=   0   'False
      Height          =   495
      Left            =   7200
      TabIndex        =   17
      Top             =   5640
      Width           =   1095
   End
   Begin VB.CommandButton Comundes 
      Caption         =   "数据解密"
      Height          =   495
      Left            =   5640
      TabIndex        =   16
      Top             =   5640
      Width           =   1095
   End
   Begin VB.CommandButton Comendes 
      Caption         =   "数据加密"
      Height          =   495
      Left            =   4080
      TabIndex        =   15
      Top             =   5640
      Width           =   1095
   End
   Begin VB.CommandButton Comchange 
      Caption         =   "修改密码"
      Height          =   495
      Left            =   7440
      TabIndex        =   14
      Top             =   4920
      Width           =   1095
   End
   Begin VB.CommandButton Comread 
      Caption         =   "读密码"
      Height          =   495
      Left            =   6240
      TabIndex        =   13
      Top             =   4920
      Width           =   1095
   End
   Begin VB.CommandButton Comcheck 
      Caption         =   "核对密码"
      Height          =   495
      Left            =   5040
      TabIndex        =   12
      Top             =   4920
      Width           =   1095
   End
   Begin VB.CommandButton Command3 
      Caption         =   "测试卡"
      Height          =   495
      Left            =   5400
      TabIndex        =   11
      Top             =   3360
      Width           =   1095
   End
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   495
      Left            =   6840
      TabIndex        =   10
      Top             =   3360
      Width           =   1095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "设备状态"
      Height          =   495
      Left            =   3960
      TabIndex        =   9
      Top             =   2520
      Width           =   1095
   End
   Begin VB.CommandButton cmdPowerOff 
      Caption         =   "下 电"
      Height          =   495
      Left            =   3960
      TabIndex        =   8
      Top             =   3360
      Width           =   1095
   End
   Begin VB.TextBox editRetCode 
      Height          =   495
      Left            =   2520
      TabIndex        =   6
      Top             =   4200
      Width           =   975
   End
   Begin VB.CommandButton cmdGetDeviceNumber 
      Caption         =   "取设备号"
      Height          =   495
      Left            =   6840
      TabIndex        =   5
      Top             =   2520
      Width           =   1095
   End
   Begin VB.CommandButton cmdPowerOn 
      Caption         =   "上  电"
      Height          =   495
      Left            =   2520
      TabIndex        =   4
      Top             =   3360
      Width           =   1095
   End
   Begin VB.CommandButton cmdUnLinkCom 
      Caption         =   "释放串口"
      Height          =   495
      Left            =   5400
      TabIndex        =   3
      Top             =   2520
      Width           =   1095
   End
   Begin VB.CommandButton cmdLinkCom1 
      Caption         =   "选择串口"
      Height          =   495
      Left            =   2520
      TabIndex        =   2
      Top             =   2520
      Width           =   1095
   End
   Begin VB.TextBox editOutBuf 
      Height          =   1575
      Left            =   2520
      TabIndex        =   0
      Top             =   600
      Width           =   5415
   End
   Begin VB.Label Label2 
      Caption         =   "请输入密码"
      Height          =   495
      Left            =   4080
      TabIndex        =   19
      Top             =   4320
      Width           =   1095
   End
   Begin VB.Label Label7 
      Caption         =   "返回值:"
      Height          =   615
      Left            =   1440
      TabIndex        =   7
      Top             =   4320
      Width           =   975
   End
   Begin VB.Label Label1 
      Caption         =   "输出显示:"
      Height          =   495
      Left            =   1200
      TabIndex        =   1
      Top             =   840
      Width           =   975
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Data1 As String * 16
Dim Data2 As String * 16
Dim databuff1(7) As Byte
Dim databuff2(7) As Byte
Dim offset As Integer
Dim length As Integer
Dim status As Integer
Dim password(2) As Byte
Dim proval As String * 8
Dim counter As Integer
Dim oldpass As String
Dim ptrdest(16) As Byte
Dim ptrsource As String * 16
Private Sub cmdAutoLinkCom_Click()
       icdev = auto_init(0, 9600)
If icdev < 0 Then
    editOutBuf.AddItem ("Init error!")
    Exit Sub
Else
    editOutBuf.AddItem ("Init OK")
End If
End Sub

Private Sub cmdGetDeviceNumber_Click()
   Dim DeviceNumber As String * 18
    Dim i&
    st = srd_ver(icdev, 18, DeviceNumber)
    If st < 0 Then
    editOutBuf.Text = "读版本号失败"
    Else
    editOutBuf.Text = "读版本号成功"
    End If
   
    editRetCode.Text = st
    If st = 0 Then
       editOutBuf.Text = DeviceNumber
    Else
       editOutBuf.Text = "Error !"
    End If
End Sub

Private Sub cmdLinkCom1_Click()
   icdev = auto_init(0, 9600)
If icdev < 0 Then
   editOutBuf.Text = "Init error!"
    Exit Sub
Else
 editOutBuf.Text = "Init OK"
    End If
End Sub



Private Sub cmdPowerOff_Click()
   st = turn_off(icdev)
    editRetCode.Text = st
    If st = 0 Then
       editOutBuf.Text = "OK !"
    Else
       editOutBuf.Text = "Error !"
    End If
End Sub

Private Sub cmdPowerOn_Click()
 st = turn_on(icdev)
    editRetCode.Text = st
    If st = 0 Then
       editOutBuf.Text = "OK !"
    Else
       editOutBuf.Text = "Error !"
    End If
End Sub

Private Sub cmdUnLinkCom_Click()
    st = ic_exit(icdev)
    editRetCode.Text = st
    If st = 0 Then
       editOutBuf.Text = "OK !"
    Else
       editOutBuf.Text = "Error !"
    End If
End Sub



Private Sub Comclear_Click()
txtpw.Text = ""
txtpw.SetFocus
End Sub


Private Sub Command1_Click()
st = get_status(icdev, status)
If st < 0 Then
 editRetCode.Text = "Status error"
  Exit Sub
Else
 editRetCode.Text = "Status ok"
End If
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Command3_Click()
st = chk_4442(icdev)
If st < 0 Then
    editOutBuf.Text = "卡类型错误"
    Exit Sub
Else
    editOutBuf.Text = "卡类型正确,卡型为:SLE4442  "
End If

End Sub

Private Sub Comcheck_Click()
oldpass = txtpw.Text
st = asc_hex(oldpass, password(0), 3)
If st < 0 Then
     editOutBuf.Text = "ASCII码转十六进制换数据失败"
    Exit Sub
Else
    editOutBuf.Text = "ASCII码转十六进制换数据成功"
End If

'MsgBox oldpass & password(0) & " " & password(1) & " " & password(2)

st = csc_4442(icdev, 3, password(0))
If st < 0 Then
    editOutBuf.Text = "密码核对失败"
    Exit Sub
Else
    editOutBuf.Text = "密码核对成功"
End If

End Sub

Private Sub Comread_Click()
st = rsc_4442(icdev, 3, password(0))
 
If st < 0 Then
    editOutBuf.Text = "读密码失败"
    Exit Sub
Else
    editOutBuf.Text = "读密码成功" + "密码:" + hex(password(0)) + hex(password(1)) + hex(password(2))
End If
End Sub

Private Sub Comchange_Click()
st = rsc_4442(icdev, 3, password(0))
 
If st < 0 Then
    editOutBuf.Text = "读密码失败"
    Exit Sub
Else
    editOutBuf.Text = "读密码成功" + "密码:" + hex(password(0)) + hex(password(1)) + hex(password(2))
End If
End Sub

Private Sub Comcount_Click()
st = rsct_4442(icdev, counter)
If st < 0 Then
    editOutBuf.Text = "rsct  error"
    Exit Sub
Else
    editOutBuf.Text = "rsct Ok"
    editOutBuf.Text = (Str(counter))
    
End If
End Sub

⌨️ 快捷键说明

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