📄 frmmain.frm
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmMain
BorderStyle = 1 'Fixed Single
Caption = "HD6k发卡器VB例程"
ClientHeight = 5220
ClientLeft = 45
ClientTop = 330
ClientWidth = 7545
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5220
ScaleWidth = 7545
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton cmdsetwk
Caption = "设置工作密钥"
Height = 375
Left = 5880
TabIndex = 25
Top = 2760
Width = 1455
End
Begin VB.CommandButton cmdReadCard6K
Caption = "6k读卡"
Height = 375
Left = 5880
TabIndex = 29
Top = 840
Width = 1455
End
Begin VB.CommandButton cmdwritecard6k
Caption = "6K写卡"
Height = 375
Left = 5880
TabIndex = 28
Top = 1320
Width = 1455
End
Begin VB.CommandButton cmdreadew6k
Caption = "6K读钱包"
Height = 375
Left = 5880
TabIndex = 27
Top = 1800
Width = 1455
End
Begin VB.CommandButton cmdwriteew6k
Caption = "6K写钱包"
Height = 375
Left = 5880
TabIndex = 26
Top = 2280
Width = 1455
End
Begin VB.CommandButton cmderasecard
Caption = "洗卡"
Height = 375
Left = 4440
TabIndex = 24
Top = 1320
Width = 1215
End
Begin VB.CommandButton cmdclearcard
Caption = "清卡数据"
Height = 375
Left = 4440
TabIndex = 23
Top = 1800
Width = 1215
End
Begin VB.CommandButton cmdInitHD6k
Caption = "初始化6k卡"
Height = 375
Left = 4440
TabIndex = 22
Top = 840
Width = 1215
End
Begin VB.CommandButton cmdWriteHD4kEW
Caption = "写HD4k钱包"
Height = 375
Left = 3000
TabIndex = 21
Top = 2280
Width = 1215
End
Begin VB.CommandButton cmdReadHD4kEW
Caption = "读HD4k钱包"
Height = 375
Left = 3000
TabIndex = 20
Top = 1800
Width = 1215
End
Begin VB.CommandButton cmdWriteHD4k
Caption = "写HD4k卡"
Height = 375
Left = 3000
TabIndex = 19
Top = 1320
Width = 1215
End
Begin VB.CommandButton cmdReadHD4k
Caption = "读HD4k卡"
Height = 375
Left = 3000
TabIndex = 18
Top = 840
Width = 1215
End
Begin VB.CommandButton cmdLED
Caption = "LED"
Height = 375
Left = 120
TabIndex = 17
Top = 2760
Width = 1215
End
Begin VB.CommandButton cmdReduceEW
Caption = "减钱包"
Height = 375
Left = 1560
TabIndex = 16
Top = 1800
Width = 1215
End
Begin VB.CommandButton cmdAddEW
Caption = "加钱包"
Height = 375
Left = 1560
TabIndex = 15
Top = 1320
Width = 1215
End
Begin VB.CommandButton cmdInitEW
Caption = "初始化钱包"
Height = 375
Left = 1560
TabIndex = 14
Top = 840
Width = 1215
End
Begin VB.CommandButton cmdWriteBlock
Caption = "写块"
Height = 375
Left = 1560
TabIndex = 13
Top = 2760
Width = 1215
End
Begin VB.CommandButton cmdReadBlock
Caption = "读块"
Height = 375
Left = 1560
TabIndex = 12
Top = 2280
Width = 1215
End
Begin VB.ListBox lstData
Height = 1530
ItemData = "frmMain.frx":0000
Left = 0
List = "frmMain.frx":0002
TabIndex = 11
Top = 3240
Width = 7320
End
Begin VB.CommandButton cmdSetWaitTime
Caption = "设等待时间"
Height = 375
Left = 120
TabIndex = 10
Top = 2280
Width = 1215
End
Begin MSComctlLib.StatusBar stbResult
Align = 2 'Align Bottom
Height = 375
Left = 0
TabIndex = 9
Top = 4845
Width = 7545
_ExtentX = 13309
_ExtentY = 661
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 2
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Alignment = 1
Object.Width = 2258
MinWidth = 2258
Text = "操作结果"
TextSave = "操作结果"
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 9596
MinWidth = 9596
EndProperty
EndProperty
End
Begin VB.TextBox txtPortSet
Height = 375
Left = 2040
TabIndex = 6
Text = "38400,n,8,1"
Top = 240
Width = 1695
End
Begin VB.TextBox txtCommPort
Height = 375
Left = 960
TabIndex = 5
Text = "1"
Top = 240
Width = 375
End
Begin VB.CommandButton cmdExit
Caption = "退出"
Height = 375
Left = 4920
TabIndex = 4
Top = 120
Width = 1095
End
Begin VB.CommandButton cmdBeep
Caption = "鸣叫"
Height = 375
Left = 120
TabIndex = 3
Top = 1800
Width = 1215
End
Begin VB.CommandButton cmdReaderProp
Caption = "读卡器属性"
Height = 375
Left = 120
TabIndex = 2
Top = 840
Width = 1215
End
Begin VB.CommandButton cmdReadCardID
Caption = "读卡序列号"
Height = 375
Left = 120
TabIndex = 1
Top = 1320
Width = 1215
End
Begin VB.CommandButton cmdConnect
Caption = "连接端口"
Height = 375
Left = 3840
TabIndex = 0
Top = 120
Width = 1095
End
Begin MSCommLib.MSComm MSComm
Left = 5040
Top = 240
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
CommPort = 3
DTREnable = 0 'False
RThreshold = 12
BaudRate = 38400
InputMode = 1
End
Begin VB.Label Label2
Caption = "配置:"
Height = 375
Left = 1440
TabIndex = 8
Top = 360
Width = 855
End
Begin VB.Label Label1
Caption = "串口号:"
Height = 255
Left = 120
TabIndex = 7
Top = 360
Width = 855
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim m_bResult As Boolean
Dim m_bBuffer(0 To 999) As Byte
Dim m_nBufferLength As Long
Dim m_bSendData() As Byte
Dim m_CardID As CARDIDSTRUCT
Dim m_nLEDCount As Integer
Dim nConnect As Boolean
Dim Prop As READERPROPSTRUCT
Dim Exitobject As Boolean
Dim Beep As BEEPSTRUCT
Dim str As String
Dim Sector As SECTORSTRUCT
Dim CardReturn As CARDINFO_HD6K
Dim kk As Integer '主要是用来循环控制变量
Dim EWInfo As EW_HD6K '读钱包
Dim card As CARDINFO_HD6K '处理读卡时用于接受数据
Private Sub cmdclearcard_Click()
If m_CardID.CardID <> 0 Then
'Call SendCommand(MT_ERASEDATA_CARDOFHD6K, m_CardID, Len(m_CardID)) ' 清卡数据
MSComm.InBufferCount = 0
MSComm.OutBufferCount = 0
stbResult.Panels(2).Text = ""
If MSComm.PortOpen Then
m_nBufferLength = 1000
m_bResult = SendCommandA(MT_ERASEDATA_CARDOFHD6K, m_CardID, Len(m_CardID), m_bBuffer(0), m_nBufferLength)
If m_bResult Then
ReDim m_bSendData(0 To m_nBufferLength - 1) As Byte
Call CopyMemory(m_bSendData(0), m_bBuffer(0), m_nBufferLength)
MSComm.Output = m_bSendData
Else: MsgBox "命令发送失败"
End If
End If
Else: MsgBox "请先寻卡"
End If
End Sub
Private Sub cmderasecard_Click()
If m_CardID.CardID <> 0 Then
'Call SendCommand(MT_ERASE_CARDOFHD6K, m_CardID, Len(m_CardID)) ' 洗卡(清卡密码及数据)
MSComm.InBufferCount = 0
MSComm.OutBufferCount = 0
stbResult.Panels(2).Text = ""
MsgBox m_CardID.CardID
If MSComm.PortOpen Then
m_nBufferLength = 1000
m_bResult = SendCommandA(MT_ERASE_CARDOFHD6K, m_CardID, Len(m_CardID), m_bBuffer(0), m_nBufferLength)
If m_bResult Then
ReDim m_bSendData(0 To m_nBufferLength - 1) As Byte
Call CopyMemory(m_bSendData(0), m_bBuffer(0), m_nBufferLength)
MSComm.Output = m_bSendData
Else: MsgBox "命令发送失败"
End If
End If
Else: MsgBox "请先寻卡"
End If
End Sub
Private Sub cmdReadCard6K_Click()
If m_CardID.CardID <> 0 Then
'读卡时注意卡m_CardID.CardType 存放的是钱包索引
m_CardID.CARDTYPE = 1
MSComm.InBufferCount = 0
MSComm.OutBufferCount = 0
stbResult.Panels(2).Text = ""
If MSComm.PortOpen Then
m_nBufferLength = 1000
m_bResult = SendCommandA(MT_READDATA_CARDOFHD6K, m_CardID, Len(m_CardID), m_bBuffer(0), m_nBufferLength)
If m_bResult Then
ReDim m_bSendData(0 To m_nBufferLength - 1) As Byte
Call CopyMemory(m_bSendData(0), m_bBuffer(0), m_nBufferLength)
MSComm.Output = m_bSendData
Else: MsgBox "命令发送失败"
End If
End If
Else
MsgBox "请先寻卡"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -