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

📄 tm91.bas

📁 这是一个银行IC卡门禁系统软件
💻 BAS
📖 第 1 页 / 共 3 页
字号:
        PortNum = i
        PortType = 5
        SHandle = TMExtendedStartSession(PortNum, PortType, vbNullString)

        If TMSetup(SHandle) = 1 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), &H2) >= 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, &H66)
                            flag = TMTouchByte(SHandle, &H10)
                            flag = TMTouchByte(SHandle, &HEF)

                            For i = 0 To 7

                                subid(i) = TMTouchByte(SHandle, &HFF)

                            Next i

                            recs = ""

                            For i = 0 To 7

                                temp(i) = subid(i)

                                If (subid(i) <= 15) Then

                                    recs = recs + "0" + Hex(subid(i))

                                Else

                                    recs = recs + Hex(subid(i))

                                End If

                            Next i
                            
                            cardtype = Trim(Str(subid(0)))

                            While Len(cardtype) < 2

                                cardtype = "0" + cardtype

                            Wend

                            notcardtype = "13"

                            While Len(notcardtype) < 2

                                notcardtype = "0" + notcardtype

                            Wend
                            
                            cardcode = Hex(subid(1) * 256 + subid(2))

                            While Len(cardcode) < 4

                                cardcode = "0" + cardcode

                            Wend

                            notcardcode = "2508"

                            While Len(notcardcode) < 4

                                notcardcode = "0" + notcardcode

                            Wend

                                recs = recs + "0103020513250809"


                            For i = 0 To 7

                                temp(i) = Val("&H" + Mid(recs, 2 * i + 17, 2))

                            Next i
                            
                            For i = 0 To 7

                                flag = TMTouchByte(SHandle, temp(i))

                            Next i

                            For i = 0 To 47

                                temp(i) = TMTouchByte(SHandle, &HFF)

                            Next i

                            For i = 0 To 47

                                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)
                                readsub1 = 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)
        readsub1 = ""

    End If

End Function

Public Function readsub2(ptemp As String)
    
    Dim subid(8) As Byte
    Dim temp(64) As Byte
    Dim flag As Integer
    Dim i As Integer
    Dim recs As String
    Dim cardtype As String
    Dim notcardtype As String
    Dim cardcode As String
    Dim notcardcode As String
    Dim hotelnum As String
    Dim hotelpas As String
    
    cardtype = Mid(ptemp, 1, 2)
    cardcode = Mid(ptemp, 3, 4)
    hotelnum = Mid(ptemp, 7, 4)
    hotelpas = Mid(ptemp, 11, 4)
    
    notcardtype = Hex(255 - Val("&H" + cardtype))

    While Len(notcardtype) < 2

        notcardtype = "0" + notcardtype

    Wend
    
    notcardcode = Hex(65535 - Val("&H" + cardcode))

    While Len(notcardcode) < 4

        notcardcode = "0" + notcardcode

    Wend
    
    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), &H2) >= 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, &H66)
                            flag = TMTouchByte(SHandle, &H50)
                            flag = TMTouchByte(SHandle, &HAF)

                            For i = 0 To 7

                                subid(i) = TMTouchByte(SHandle, &HFF)

                            Next i

                            recs = ""

                            For i = 0 To 7

                                temp(i) = subid(i)

                                If (subid(i) <= 15) Then

                                    recs = recs + "0" + Hex(subid(i))

                                Else

                                    recs = recs + Hex(subid(i))

                                End If

                            Next i
                            
                            recs = recs + hotelnum + hotelpas + notcardtype + notcardcode + "02"
                            
                            For i = 0 To 7

                                temp(i) = Val("&H" + Mid(recs, 2 * i + 17, 2))

                            Next i
                            
                            For i = 0 To 7

                                flag = TMTouchByte(SHandle, temp(i))

                            Next i

                            For i = 0 To 47

                                temp(i) = TMTouchByte(SHandle, &HFF)

                            Next i

                            For i = 0 To 47

                                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)
                                readsub2 = 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)
        readsub2 = ""

    End If

End Function

Public Function readsub3(ptemp As String)
    
    Dim subid(8) As Byte
    Dim temp(64) As Byte
    Dim flag As Integer
    Dim i As Integer
    Dim recs As String
    Dim cardtype As String
    Dim notcardtype As String
    Dim cardcode As String
    Dim notcardcode As String
    Dim hotelnum As String
    Dim hotelpas As String
    
    cardtype = Mid(ptemp, 1, 2)
    cardcode = Mid(ptemp, 3, 4)
    hotelnum = Mid(ptemp, 7, 4)
    hotelpas = Mid(ptemp, 11, 4)
    
    notcardtype = Hex(255 - Val("&H" + cardtype))

    While Len(notcardtype) < 2

        notcardtype = "0" + notcardtype

    Wend
    
    notcardcode = Hex(65535 - Val("&H" + cardcode))

    While Len(notcardcode) < 4

        notcardcode = "0" + notcardcode

    Wend
    
    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), &H2) >= 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, &H66)
                            flag = TMTouchByte(SHandle, &H90)
                            flag = TMTouchByte(SHandle, &H6F)

                            For i = 0 To 7

                                subid(i) = TMTouchByte(SHandle, &HFF)

                            Next i

                            recs = ""

                            For i = 0 To 7

                                temp(i) = subid(i)

                                If (subid(i) <= 15) Then

                                    recs = recs + "0" + Hex(subid(i))

                                Else

                                    recs = recs + Hex(subid(i))

                                End If

                            Next i
                            
                            recs = recs + hotelnum + hotelpas + notcardtype + notcardcode + "03"
                            
                            For i = 0 To 7

                                temp(i) = Val("&H" + Mid(recs, 2 * i + 17, 2))

                            Next i
                            
                            For i = 0 To 7

                                flag = TMTouchByte(SHandle, temp(i))

                            Next i

                            For i = 0 To 47

                                temp(i) = TMTouchByte(SHandle, &HFF)

                            Next i

                            For i = 0 To 47

                                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)
                                readsub3 = 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)
        readsub3 = ""

    End If

End Function

⌨️ 快捷键说明

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