• 大小: 105KB
    文件类型: .zip
    金币: 2
    下载: 0 次
    发布日期: 2024-02-01
  • 语言: C#
  • 标签:

资源简介

神思ss628型USB二代身份证读卡器的调用源码

资源截图

代码片段和文件信息

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

namespace ReadIDCardApplicationVS5
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        /// 
        /// 读取身份证信息
        /// 

        /// 
        /// 
        private void btnRead_Click(object sender EventArgs e)
        {
            string sMsg = string.Empty;
            //初始化
            if (!IDCardReader.InitCom(0 out sMsg))
            {
                MessageBox.Show(sMsg);
            }

            //发布后的运行路劲,发布的是Release版本的
            string sPath = System.Environment.CurrentDirectory.Substring(0 System.Environment.CurrentDirectory.LastIndexOf(‘\\‘)); //
            sPath = System.Environment.CurrentDirectory + “\\“;
            //MessageBox.Show(sPath);
            //未发布的程序运行路劲
#if DEBUG
            sPath = System.Windows.Forms.Application.StartupPath;
#endif

            CardInfo objIDCardInfo = null;
            try
            {
                //读身份证对象
                objIDCardInfo = IDCardReader.ReadCardInfo(0 out sMsg sPath);

                if (!string.IsNullOrEmpty(sMsg))
                    MessageBox.Show(sMsg);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message “系统提示“);
            }

            if (objIDCardInfo != null)
            {
                //赋值
                txtIDCard.Text = objIDCardInfo.CardNo;
                txtName1.Text = objIDCardInfo.Name;
                txtSex1.Text = objIDCardInfo.Sex;
                txtBirthday1.Text = objIDCardInfo.Birthday;
                txtStartDate1.Text = objIDCardInfo.StartDate;
                txtEndDate1.Text = objIDCardInfo.EndDate;
                txtNation1.Text = objIDCardInfo.Nation;
                txtAddress1.Text = objIDCardInfo.Address;

                System.IO.MemoryStream objMSPhoto = new System.IO.MemoryStream(objIDCardInfo.ArrPhotoByte 0 objIDCardInfo.ArrPhotoByte.Length);
                Image objImage = Image.FromStream(objMSPhoto);
                this.panel1.BackgroundImage = objImage;

            }
        }

        /// 
        /// 清空身份证信息
        /// 

        /// 
        /// 
        private void button2_Click(object sender EventArgs e)
        {
            txtIDCard.Text = string.Empty;
            txtName1.Text = string.Empty;
            txtSex1.Text = string.Empty;
            txtBirthday1.Text = string.Empty;
            txtStartDate1.Text = string.Empty;
            txtEndDate1.Text = string.Empty;
            txtNation1.Text = string.Empty;
            txtAddress1.Text = string.Empty;

            this.pa

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-04-07 10:59  Backup\
     目录           0  2013-04-07 10:59  Backup\ReadIDCardApplicationVS5\
     文件       29534  2010-08-24 08:55  Backup\ReadIDCardApplicationVS5\Form1.Designer.cs
     文件        3164  2010-08-24 10:04  Backup\ReadIDCardApplicationVS5\Form1.cs
     文件        5814  2010-08-24 08:55  Backup\ReadIDCardApplicationVS5\Form1.resx
     文件        9978  2010-08-27 17:47  Backup\ReadIDCardApplicationVS5\IDCardReader.cs
     文件         483  2010-08-24 08:43  Backup\ReadIDCardApplicationVS5\Program.cs
     目录           0  2013-04-07 10:59  Backup\ReadIDCardApplicationVS5\Properties\
     文件        1220  2010-08-24 08:43  Backup\ReadIDCardApplicationVS5\Properties\AssemblyInfo.cs
     文件        2904  2010-08-24 08:43  Backup\ReadIDCardApplicationVS5\Properties\Resources.Designer.cs
     文件        5612  2010-08-24 08:43  Backup\ReadIDCardApplicationVS5\Properties\Resources.resx
     文件        1109  2010-08-24 08:43  Backup\ReadIDCardApplicationVS5\Properties\Settings.Designer.cs
     文件         249  2010-08-24 08:43  Backup\ReadIDCardApplicationVS5\Properties\Settings.settings
     文件       36864  2010-08-23 10:36  Backup\ReadIDCardApplicationVS5\RdCard.dll
     文件        4946  2010-08-27 00:08  Backup\ReadIDCardApplicationVS5\ReadIDCardApplicationVS5.csproj
     文件         651  2010-08-24 10:04  Backup\ReadIDCardApplicationVS5\ReadIDCardApplicationVS5.csproj.user
     文件        1668  2010-08-24 09:02  Backup\ReadIDCardApplicationVS5\ReadIDCardApplicationVS5_TemporaryKey.pfx
     文件       90112  2010-08-23 10:36  Backup\ReadIDCardApplicationVS5\WltRS.dll
     文件       65536  2010-08-23 10:36  Backup\ReadIDCardApplicationVS5\sdtapi.dll
     文件         961  2010-08-24 08:43  Backup\ReadIDCardApplicationVS5.sln
     文件       20480  2010-08-27 15:18  Backup\ReadIDCardApplicationVS5.suo

评论

共有 条评论

相关资源