基本信息
源码名称:二代身份证阅读实例(VC_C#_Delphi)
源码大小:1.56M
文件格式:.rar
开发语言:C#
更新时间:2018-10-27
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍
华旭二次开发包\二次开发包\二代身份证阅读实例(VC_C#_Delphi)\C#NOTest\NOTest

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace NOTest
{
    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();
        }
        #region API声明
        [DllImport("sdtapi.dll", CallingConvention = CallingConvention.StdCall)]
        static extern int SDT_StartFindIDCard (int iPort,  byte[] pucManaInfo,int iIfOpen);
        [DllImport("sdtapi.dll",CallingConvention = CallingConvention.StdCall)]
        static extern int SDT_SelectIDCard (int iPort , byte[] pucManaMsg,int iIfOpen);
        [DllImport("sdtapi.dll",CallingConvention = CallingConvention.StdCall)]
        static extern int SDT_ReadBaseMsg (int iPort, byte[] pucCHMsg, ref UInt32 puiCHMsgLen, byte[] pucPHMsg,ref UInt32 puiPHMsgLen,int iIfOpen);
        #endregion
        private void button1_Click(object sender, EventArgs e)
        {
            //变量声明
            byte[] CardPUCIIN = new byte[255];
            byte[] pucManaMsg = new byte[255];
            byte[] pucCHMsg = new byte[255];
            byte[] pucPHMsg = new byte[3024];
            UInt32 puiCHMsgLen=0;
            UInt32 puiPHMsgLen=0;
            int st =0;
            //读卡操作
            st= SDT_StartFindIDCard(1, CardPUCIIN, 1);
            if (st != 0x9f) return;
            st = SDT_SelectIDCard(1,  pucManaMsg, 1);
            if (st != 0x90) return;
            st = SDT_ReadBaseMsg(1,   pucCHMsg, ref puiCHMsgLen,   pucPHMsg, ref puiPHMsgLen, 1);
            if (st != 0x90) return;
            //显示结果
            textBox1.Text = System.Text.ASCIIEncoding.Unicode.GetString(pucCHMsg);

        }
    }
}