tm95.bas
来自「这是一个银行IC卡门禁系统软件」· BAS 代码 · 共 250 行
BAS
250 行
Attribute VB_Name = "tm95"
Option Explicit
'Global SHandle As Long
'Global state_buffer() As Byte
'Global Debounce(100) As Integer
'Global SelectROM(8) As Integer
'Global SelectFile(6) As Byte
'Global DirBuf(256) As Byte
'Global SaveEditData As String
'Global SetupDone As Integer
'Global MaxDbnc As Integer
'
'Declare Function RegOpenKeyExA Lib "Advapi32.DLL" (ByVal hKey As Long, ByVal lpszSubKey As String, ByVal dwReserved As Long, ByVal samDesired As Long, phkResult As Long) As Long
'Declare Function RegQueryValueExA Lib "Advapi32.DLL" (ByVal hKey As Long, ByVal lpszValueName As String, ByVal lpdwReserved As Any, lpdwType As Long, lpbData As Byte, lpcbData As Long) As Long
'Declare Function RegCloseKey Lib "Advapi32.DLL" (ByVal hKey As Long) As Long
'Public Const KEY_READ As Long = &H120019
'Public Const HKEY_LOCAL_MACHINE As Long = &H80000002
'Public Const ERROR_SUCCESS As Long = &H0
'Public Const REG_SZ As Long = &H1
'
Public Function writetm95(ptemp As String)
Dim ta1 As Byte
Dim ta2 As Byte
Dim es As Byte
Dim temp(6) As Byte
Dim stemp(6) As Byte
Dim flag As Integer
Dim i As Integer
Dim recs As String
For i = 0 To 5
temp(i) = Val("&H" + Mid(ptemp, 2 * i + 1, 2))
Next i
For i = 1 To 4
PortNum = i
PortType = 5
SHandle = TMExtendedStartSession(PortNum, PortType, vbNullString)
If SHandle > 0 Then
Exit For
End If
Next i
If (SHandle > 0) Then
If (TMSetup(SHandle) = 1) Then
If (TMSetup(SHandle) = 1) Then
If TMFamilySearchSetup(SHandle, state_buffer(0), &HA) >= 1 Then
If (TMNext(SHandle, state_buffer(0)) = 1) Then
flag = TMRom(SHandle, state_buffer(0), SelectROM(0))
If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then
flag = TMTouchByte(SHandle, &HF)
flag = TMTouchByte(SHandle, &H0)
flag = TMTouchByte(SHandle, &H0)
For i = 0 To 5
flag = TMTouchByte(SHandle, temp(i))
Next i
If TMTouchReset(SHandle) = 1 Then
If (TMSetup(SHandle) = 1) Then
If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then
flag = TMTouchByte(SHandle, &HAA)
ta1 = TMTouchByte(SHandle, &HFF)
ta2 = TMTouchByte(SHandle, &HFF)
es = TMTouchByte(SHandle, &HFF)
For i = 0 To 5
stemp(i) = TMTouchByte(SHandle, &HFF)
Next i
For i = 0 To 5
If temp(i) <> stemp(i) Then
writetm95 = False
SHandle = TMEndSession(SHandle)
Exit Function
End If
Next i
If TMTouchReset(SHandle) = 1 Then
If (TMSetup(SHandle) = 1) Then
If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then
flag = TMTouchByte(SHandle, &H55)
flag = TMTouchByte(SHandle, ta1)
flag = TMTouchByte(SHandle, ta2)
flag = TMTouchByte(SHandle, es)
If TMTouchReset(SHandle) = 1 Then
TMEndSession (SHandle)
writetm95 = True
Exit Function
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If TMTouchReset(SHandle) = 1 Then
SHandle = TMEndSession(SHandle)
writetm95 = False
End If
End Function
Public Function readtm95()
Dim temp(2048) As Byte
Dim flag As Integer
Dim i As Integer
Dim recs As String
For i = 1 To 4
PortNum = i
PortType = 5
SHandle = TMExtendedStartSession(PortNum, PortType, vbNullString)
If SHandle > 0 Then
Exit For
End If
Next i
If (SHandle > 0) Then
If (TMSetup(SHandle) = 1) Then
If (TMSetup(SHandle) = 1) Then
If TMFamilySearchSetup(SHandle, state_buffer(0), &HA) >= 1 Then
If (TMNext(SHandle, state_buffer(0)) = 1) Then
flag = TMRom(SHandle, state_buffer(0), SelectROM(0))
If (TMStrongAccess(SHandle, state_buffer(0)) = 1) Then
flag = TMTouchByte(SHandle, &HF0)
flag = TMTouchByte(SHandle, &H0)
flag = TMTouchByte(SHandle, &H0)
For i = 0 To 2047
temp(i) = TMTouchByte(SHandle, &HFF)
Next i
recs = ""
For i = 0 To 2047
If (temp(i) <= 15) Then
recs = recs + "0" + Hex(temp(i))
Else
recs = recs + Hex(temp(i))
End If
Next i
If TMTouchReset(SHandle) = 1 Then
TMEndSession (SHandle)
readtm95 = recs
Exit Function
End If
End If
End If
End If
End If
End If
End If
If TMTouchReset(SHandle) = 1 Then
SHandle = TMEndSession(SHandle)
readtm95 = ""
End If
End Function
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?