SDK开发包怎么使

csts_002 csts_002 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
小弟在做一个Winform下的项目,其中用到了第二代身份证阅读器,品牌是“国腾GTICR100二代证”。。。

打开它的SDK,里面有“开发包”、“驱动包”、“样例源码”、和“函数包”使用手册,以及VB/VC/Deliphi的软件案例。。。ca,没有C#的。。。

看看它的开发包:

只有四个文件:termb.dll、WltRS.dll、gbk2gb13000、Nation.dat。。。

应该是把“termb.dll、WltRS.dll”在开发应用的时候添加进去就好了对吧。。。

C#的实力竟然是个“控制台程序”,而且只有读姓名和性别,不想其它VB/VC/Delephy的,什么都读出来了,而且是Winform下。。。

C#实例:


using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;


namespace ConsoleApplication1
{
class Program
{
[DllImport("termb.DLL", CallingConvention = CallingConvention.StdCall)]
public static extern int InitComm(int iPort);

[DllImport("termb.DLL", CallingConvention = CallingConvention.StdCall)]
public static extern int CloseComm();

[DllImport("termb.DLL", CallingConvention = CallingConvention.StdCall)]
public static extern int Authenticate();

[DllImport("termb.DLL", CallingConvention = CallingConvention.StdCall)]
public static extern int Read_Content(int iActive);

[DllImport("termb.DLL", CallingConvention = CallingConvention.StdCall)]
public static extern int GetPeopleName(Byte[] buf, int iLen);

[DllImport("termb.DLL", CallingConvention = CallingConvention.StdCall)]
public static extern int GetPeopleSex(Byte[] buf, int iLen);

[DllImport("termb.DLL", CallingConvention = CallingConvention.StdCall)]
public static extern int GetPeopleNation(StringBuilder buf, int iLen);

[DllImport("termb.DLL", CallingConvention = CallingConvention.StdCall)]
public static extern int GetPeopleBirthday(StringBuilder buf, int iLen);

[DllImport("termb.DLL", CallingConvention = CallingConvention.StdCall)]
public static extern int GetPeopleAddress(StringBuilder buf, int iLen);

[DllImport("termb.DLL", CallingConvention = CallingConvention.StdCall)]
public static extern int GetStartDate(StringBuilder buf, int iLen);

[DllImport("termb.DLL", CallingConvention = CallingConvention.StdCall)]
public static extern int GetEndDate(StringBuilder buf, int iLen);

static string GetName()
{
Byte[] asciiBytes = null;
asciiBytes = new Byte[100];
int dwRet = GetPeopleName(asciiBytes, 100);
Encoding gb2312 = Encoding.GetEncoding("gb2312");
char[] asciiChars = new char[gb2312.GetCharCount(asciiBytes, 0, dwRet)];
gb2312.GetChars(asciiBytes, 0, dwRet, asciiChars, 0);
return new string(asciiChars);
}

static string GetSex()
{
Byte[] asciiBytes = null;
asciiBytes = new Byte[100];
int dwRet = GetPeopleSex(asciiBytes, 100);
Encoding gb2312 = Encoding.GetEncoding("gb2312");
char[] asciiChars = new char[gb2312.GetCharCount(asciiBytes, 0, dwRet)];
gb2312.GetChars(asciiBytes, 0, dwRet, asciiChars, 0);
return new string(asciiChars);
}

static void Main(string[] args)
{

int i = InitComm(1);
i = Authenticate();
i = Read_Content(1);

string szValue = null;

szValue = GetName();
szValue = GetSex();
Console.Read();

}
}
}

小弟要把它改为Winform下的程序,请问照片应该怎样读???方法怎样写???

不太擅闯API啊。。。
...全文

相关推荐

评论 7
收藏 已收藏
分享
返回顶部
csts_002
C# 111,128 成员 642,536 内容