VB6四字节卡号相互转换源码

2023-10-10 00:50

本文主要是介绍VB6四字节卡号相互转换源码,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

读卡器介绍:ID IC ICode 2 HID ICLASS 二代证RFID读卡器USB模拟键盘输出卡号-淘宝网 (taobao.com)

Private Sub Command1_Click()
Dim H2b As Double
Dim L2b As Double
Dim i As Integer
Dim HexStr, wg34 As StringDim lsh
Dim mypiccdata(4) As Bytelsh = Val(Text1)
If lsh > 4294967295# ThenMsgBox "数据大于4字节会溢出!请重新输入", vbCritical + vbOKOnly, "提示"Text1.SetFocusExit Sub
End IfH2b = Int(lsh / (65536))
L2b = lsh - H2b * 65536HexStr = Right("0000" + Hex(H2b), 4) + Right("0000" + Hex(L2b), 4)
Text4 = HexStrFor i = 0 To 3mypiccdata(i) = "&H" + Mid(HexStr, i * 2 + 1, 2)Text2(i) = mypiccdata(i)Text3(i) = Right("00" + Hex(mypiccdata(i)), 2)
Nextdoublecardhao = mypiccdata(1)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(2)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(3)
Text5 = Format(doublecardhao, "00000000")doublecardhao = mypiccdata(2)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(3)
Text6 = Format(mypiccdata(1), "000") + Format(doublecardhao, "00000")doublecardhao = mypiccdata(0)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(1)
wg34 = Format(doublecardhao, "00000")
doublecardhao = mypiccdata(2)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(3)
Text7 = wg34 + Format(doublecardhao, "00000")End SubPrivate Sub Command2_Click()
Dim i As Integer
Dim HexStr As String
Dim mypiccdata(4) As Byte
Dim doublecardhao As DoubleHexStr = Right("00000000" + Trim(Text4), 8)
Text4 = HexStrFor i = 0 To 3Text3(i) = Mid(HexStr, i * 2 + 1, 2)mypiccdata(i) = "&H" + Mid(HexStr, i * 2 + 1, 2)Text2(i) = mypiccdata(i)
Nextdoublecardhao = mypiccdata(0)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(1)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(2)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(3)
Text1 = Format(doublecardhao, "0000000000")doublecardhao = mypiccdata(1)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(2)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(3)
Text5 = Format(doublecardhao, "00000000")doublecardhao = mypiccdata(2)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(3)
Text6 = Format(mypiccdata(1), "000") + Format(doublecardhao, "00000")doublecardhao = mypiccdata(0)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(1)
wg34 = Format(doublecardhao, "00000")
doublecardhao = mypiccdata(2)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(3)
Text7 = wg34 + Format(doublecardhao, "00000")End SubPrivate Sub Command3_Click()
Dim i As Integer
Dim HexStr As String
Dim mypiccdata(4) As Byte
Dim doublecardhao As DoubleFor i = 0 To 3If Text2(i) = "" ThenMsgBox "请输入正确的十进制数据!", vbCritical + vbOKOnly, "提示"Text2(i).SetFocusExit SubEnd If
NextHexStr = ""
For i = 0 To 3mypiccdata(i) = Val(Text2(i))Text3(i) = Right("00" + Hex(Val(Text2(i))), 2)HexStr = HexStr + Right("00" + Hex(Val(Text2(i))), 2)
Next
Text4 = HexStrdoublecardhao = mypiccdata(0)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(1)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(2)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(3)
Text1 = Format(doublecardhao, "0000000000")doublecardhao = mypiccdata(1)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(2)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(3)
Text5 = Format(doublecardhao, "00000000")doublecardhao = mypiccdata(2)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(3)
Text6 = Format(mypiccdata(1), "000") + Format(doublecardhao, "00000")doublecardhao = mypiccdata(0)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(1)
wg34 = Format(doublecardhao, "00000")
doublecardhao = mypiccdata(2)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(3)
Text7 = wg34 + Format(doublecardhao, "00000")
End SubPrivate Sub Command4_Click()
Dim i As Integer
Dim HexStr As String
Dim mypiccdata(4) As Byte
Dim doublecardhao As DoubleFor i = 0 To 3If Text3(i) = "" ThenMsgBox "请输入正确的十六进制数据!", vbCritical + vbOKOnly, "提示"Text3(i).SetFocusExit SubEnd If
NextHexStr = ""
For i = 0 To 3mypiccdata(i) = "&H" + Trim(Text3(i))Text2(i) = mypiccdata(i)HexStr = HexStr + Right("00" + Trim(Text3(i)), 2)
Next
Text4 = HexStrdoublecardhao = mypiccdata(0)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(1)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(2)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(3)
Text1 = Format(doublecardhao, "0000000000")doublecardhao = mypiccdata(1)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(2)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(3)
Text5 = Format(doublecardhao, "00000000")doublecardhao = mypiccdata(2)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(3)
Text6 = Format(mypiccdata(1), "000") + Format(doublecardhao, "00000")doublecardhao = mypiccdata(0)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(1)
wg34 = Format(doublecardhao, "00000")
doublecardhao = mypiccdata(2)
doublecardhao = doublecardhao * 256
doublecardhao = doublecardhao + mypiccdata(3)
Text7 = wg34 + Format(doublecardhao, "00000")
End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)Select Case KeyAsciiCase 13Command1_ClickCase vbKey0 To vbKey9, vbKeyBackCase ElseKeyAscii = 0End Select
End Sub
Private Sub Text2_KeyPress(Index As Integer, KeyAscii As Integer)Select Case KeyAsciiCase vbKey0 To vbKey9, vbKeyBackCase ElseKeyAscii = 0End Select
End SubPrivate Sub Text2_LostFocus(Index As Integer)
If Text2(Index) > 255 ThenMsgBox "请输入0-255之间的数!", vbCritical + vbOKOnly, "提示"Text2(Index) = 0Text2(Index).SetFocus
End If
End SubPrivate Sub Text3_KeyPress(Index As Integer, KeyAscii As Integer)
Select Case KeyAsciiCase vbKey0 To vbKey9, vbKeyBackCase 97 To 102Case 65 To 70Case ElseKeyAscii = 0End Select
End SubPrivate Sub Text4_KeyPress(KeyAscii As Integer)
Select Case KeyAsciiCase 13Command3_ClickCase vbKey0 To vbKey9, vbKeyBackCase 97 To 102Case 65 To 70Case ElseKeyAscii = 0End Select
End Sub

这篇关于VB6四字节卡号相互转换源码的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/176771

相关文章

Linux使用dd命令来复制和转换数据的操作方法

《Linux使用dd命令来复制和转换数据的操作方法》Linux中的dd命令是一个功能强大的数据复制和转换实用程序,它以较低级别运行,通常用于创建可启动的USB驱动器、克隆磁盘和生成随机数据等任务,本文... 目录简介功能和能力语法常用选项示例用法基础用法创建可启动www.chinasem.cn的 USB 驱动

Go语言使用Buffer实现高性能处理字节和字符

《Go语言使用Buffer实现高性能处理字节和字符》在Go中,bytes.Buffer是一个非常高效的类型,用于处理字节数据的读写操作,本文将详细介绍一下如何使用Buffer实现高性能处理字节和... 目录1. bytes.Buffer 的基本用法1.1. 创建和初始化 Buffer1.2. 使用 Writ

Python 标准库time时间的访问和转换问题小结

《Python标准库time时间的访问和转换问题小结》time模块为Python提供了处理时间和日期的多种功能,适用于多种与时间相关的场景,包括获取当前时间、格式化时间、暂停程序执行、计算程序运行时... 目录模块介绍使用场景主要类主要函数 - time()- sleep()- localtime()- g

JAVA中整型数组、字符串数组、整型数和字符串 的创建与转换的方法

《JAVA中整型数组、字符串数组、整型数和字符串的创建与转换的方法》本文介绍了Java中字符串、字符数组和整型数组的创建方法,以及它们之间的转换方法,还详细讲解了字符串中的一些常用方法,如index... 目录一、字符串、字符数组和整型数组的创建1、字符串的创建方法1.1 通过引用字符数组来创建字符串1.2

Java汇编源码如何查看环境搭建

《Java汇编源码如何查看环境搭建》:本文主要介绍如何在IntelliJIDEA开发环境中搭建字节码和汇编环境,以便更好地进行代码调优和JVM学习,首先,介绍了如何配置IntelliJIDEA以方... 目录一、简介二、在IDEA开发环境中搭建汇编环境2.1 在IDEA中搭建字节码查看环境2.1.1 搭建步

Java将时间戳转换为Date对象的方法小结

《Java将时间戳转换为Date对象的方法小结》在Java编程中,处理日期和时间是一个常见需求,特别是在处理网络通信或者数据库操作时,本文主要为大家整理了Java中将时间戳转换为Date对象的方法... 目录1. 理解时间戳2. Date 类的构造函数3. 转换示例4. 处理可能的异常5. 考虑时区问题6.

.NET利用C#字节流动态操作Excel文件

《.NET利用C#字节流动态操作Excel文件》在.NET开发中,通过字节流动态操作Excel文件提供了一种高效且灵活的方式处理数据,本文将演示如何在.NET平台使用C#通过字节流创建,读取,编辑及保... 目录用C#创建并保存Excel工作簿为字节流用C#通过字节流直接读取Excel文件数据用C#通过字节

基于C#实现将图片转换为PDF文档

《基于C#实现将图片转换为PDF文档》将图片(JPG、PNG)转换为PDF文件可以帮助我们更好地保存和分享图片,所以本文将介绍如何使用C#将JPG/PNG图片转换为PDF文档,需要的可以参考下... 目录介绍C# 将单张图片转换为PDF文档C# 将多张图片转换到一个PDF文档介绍将图片(JPG、PNG)转

字节面试 | 如何测试RocketMQ、RocketMQ?

字节面试:RocketMQ是怎么测试的呢? 答: 首先保证消息的消费正确、设计逆向用例,在验证消息内容为空等情况时的消费正确性; 推送大批量MQ,通过Admin控制台查看MQ消费的情况,是否出现消费假死、TPS是否正常等等问题。(上述都是临场发挥,但是RocketMQ真正的测试点,还真的需要探讨) 01 先了解RocketMQ 作为测试也是要简单了解RocketMQ。简单来说,就是一个分

JAVA智听未来一站式有声阅读平台听书系统小程序源码

智听未来,一站式有声阅读平台听书系统 🌟 开篇:遇见未来,从“智听”开始 在这个快节奏的时代,你是否渴望在忙碌的间隙,找到一片属于自己的宁静角落?是否梦想着能随时随地,沉浸在知识的海洋,或是故事的奇幻世界里?今天,就让我带你一起探索“智听未来”——这一站式有声阅读平台听书系统,它正悄悄改变着我们的阅读方式,让未来触手可及! 📚 第一站:海量资源,应有尽有 走进“智听