读取二代身份证上面的相片,这个函数GetBmp(char * Wlt_File,int intf) 怎么用?
三、函数列表
GetBmp(char * Wlt_File,int intf) wlt文件解码成bmp文件;
四、函数说明
原 型:int GetBmp(char * Wlt_File,int intf);
说 明:本函数用于将wlt文件解码成bmp文件。
参 数:Wlt_File ----- wlt文件名
intf ----- 阅读设备通讯接口类型(1—RS-232C,2—USB)
返 回 值:生成*.bmp文件和以下返回信息
值 意义
1 相片解码解码正确
0 调用sdtapi.dll错误
-1 相片解码错误
-2 wlt文件后缀错误
-3 wlt文件打开错误
-4 wlt文件格式错误
-5 软件未授权
-6 设备连接错误
五、注意事项
1、 wlt文件的后缀要固定为”.wlt”,如:xp.wlt,相片解码成xp.bmp;
2、 本函数要与sdtapi.dll关联使用,并确认通讯端口处于关闭状态;
这是读取相片的文档,我现在把身份证上面的信息读取出来了 , 就是图片这里出了问题,图片是乱码,不知道GetBmp()第一个参数是什么值?
这是代码
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;
using System.IO;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[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_OpenPort(int iPort);
[DllImport("sdtapi.dll", CallingConvention = CallingConvention.StdCall)]
static extern int SDT_ClosePort(int iPort);
[DllImport("sdtapi.dll", CallingConvention = CallingConvention.StdCall)]
static extern int SDT_SelectIDCard(int iPort, byte[] pucManaMsg, int iIfOpen);
[DllImport("WltRS.dll", CallingConvention = CallingConvention.StdCall)]
static extern int GetBmp(string pucPHMsg, int intf);
[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);
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;
int iRet;
int iPort = 1001;
int iIfOpen = 0;
if (iIfOpen == 0)
{
iRet = SDT_OpenPort(iPort);
}
//读卡操作
st = SDT_StartFindIDCard(iPort, CardPUCIIN, iIfOpen);
if (st == 0x9f)//128
{
st = SDT_SelectIDCard(iPort, pucManaMsg, iIfOpen);
if (st != 0x90) return;//129
st = SDT_ReadBaseMsg(iPort, pucCHMsg, ref puiCHMsgLen, pucPHMsg, ref puiPHMsgLen, iIfOpen);
if (st != 0x90) return;
}
else
{
if (iIfOpen == 0)
{
//关闭
SDT_ClosePort(iPort);
return;
}
}
if (iIf