资源简介
神思二代身份证读卡程序,利用神思给的c++dll文件进行调用。
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using WindowsFormsApplication1.Class;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender EventArgs e)
{
string message = null;
Models.CardModel model = Class.ReadCardInfo.ReadCard(out message);
if (message != null)
{
}
else
{
}
}
private void button2_Click(object sender EventArgs e)
{
string pcmd = Char.ConvertFromUtf32(0x41);
string result = Application.StartupPath;
int arg0 = 0;
int arg1 = 8811;
byte [] arg2 ={ 0x02 0x27 0x00 0x00 };
//初始化端口
int flg = ReadCardAPI.UCommand1(pcmd ref arg0 ref arg1 arg2);
//验证卡
pcmd = Char.ConvertFromUtf32 (0x43);
int flg2 = ReadCardAPI.UCommand1(pcmd ref arg0 ref arg1 arg2);
//读卡
pcmd = Char.ConvertFromUtf32 (0x49);
int flg3 = ReadCardAPI.UCommand1(pcmd ref arg0 ref arg1 Encoding.GetEncoding(“GBK“).GetBytes(result));
//读取识别的身份证信息,并保存到model对象中,方便使用
Models.CardModel model = ReadCardInfo.GetCardInfo();
if (flg3 == 62171 || flg3 == 62172 || flg3 == 62173)
{
}
if (model != null)
{
textBox1.Text = ““;
string text = string.Format(“姓名:{0}\r\n 性别:{1}\r\n 民族:{2}\r\n 出生日期:{3}\r\n 住址:{4}\r\n 身份证号:{5}“ model.NAME model.SEX
model.NATION model.BIRTH model.ADDRESS model.IDNO);
textBox1.Text = text;
}
}
}
public class RCard
{
[DllImport(“./DLL/RdCard.dll“)]
public static extern int UCommand1(byte pCmd ref int arg0 ref int parg1 ref int parg2);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-12-04 09:44 .vs\
目录 0 2018-12-04 09:44 .vs\WindowsFormsApplication1\
目录 0 2018-12-04 10:20 .vs\WindowsFormsApplication1\v14\
文件 105472 2018-12-04 15:03 .vs\WindowsFormsApplication1\v14\.suo
文件 165 2018-12-04 15:07 readme.txt
文件 1393 2018-12-04 09:52 WindowsFormsApplication1.sln
目录 0 2018-12-04 15:03 WindowsFormsApplication1\
文件 187 2018-12-04 09:44 WindowsFormsApplication1\App.config
目录 0 2018-12-04 09:52 WindowsFormsApplication1\bin\
目录 0 2018-12-04 14:26 WindowsFormsApplication1\bin\Debug\
目录 0 2018-12-04 14:26 WindowsFormsApplication1\bin\Debug\CardInfo\
文件 829264 2018-12-04 09:46 WindowsFormsApplication1\bin\Debug\msvcr100.dll
文件 323072 2018-12-04 09:46 WindowsFormsApplication1\bin\Debug\RdCard.dll
文件 87040 2018-12-04 09:46 WindowsFormsApplication1\bin\Debug\sdtapi.dll
文件 128 2018-12-04 10:40 WindowsFormsApplication1\bin\Debug\Termb.Lic
文件 45056 2018-12-04 09:46 WindowsFormsApplication1\bin\Debug\unpack.dll
文件 17408 2018-12-04 14:26 WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe
文件 187 2018-12-04 09:44 WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe.config
文件 40448 2018-12-04 14:26 WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.pdb
文件 22696 2018-12-04 14:27 WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe
文件 187 2018-12-04 09:44 WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.config
文件 490 2018-04-12 07:35 WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest
文件 67584 2018-12-04 09:46 WindowsFormsApplication1\bin\Debug\WltRS.dll
目录 0 2018-12-04 09:52 WindowsFormsApplication1\bin\Release\
目录 0 2018-12-04 14:59 WindowsFormsApplication1\bin\x64\
目录 0 2018-12-04 14:27 WindowsFormsApplication1\bin\x64\Debug\
目录 0 2018-12-04 14:27 WindowsFormsApplication1\bin\x64\Debug\CardInfo\
文件 1024 2018-12-04 14:28 WindowsFormsApplication1\bin\x64\Debug\CardInfofp.bin
文件 1024 2018-12-04 14:28 WindowsFormsApplication1\bin\x64\Debug\CardInfopic.wlt
文件 135 2018-12-04 14:28 WindowsFormsApplication1\bin\x64\Debug\CardInfowx.txt
文件 256 2018-12-04 14:28 WindowsFormsApplication1\bin\x64\Debug\CardInfowz.txt
............此处省略68个文件信息
- 上一篇:用C++写的FTP客户端
- 下一篇:C++学生成绩管理系统( 毕业设计)
评论
共有 条评论