Foxtable(狐表)用户栏目专家坐堂 → 关于二代身份证读卡器的应用问题?


  共有17710人关注过本帖树形打印复制链接

主题:关于二代身份证读卡器的应用问题?

帅哥,在线噢!
狐狸爸爸
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2011/10/10 22:32:00 [显示全部帖子]

你应该要求开发商提供vb.net开发实例和说明,这样稍作修改就能套用在foxtable中。

 回到顶部
帅哥,在线噢!
狐狸爸爸
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2011/10/10 22:55:00 [显示全部帖子]

单单几个DLL文件,没有人会知道怎么用。
你应该要求开发商提供vb.net开发实例和说明,这样稍作修改就能套用在foxtable中。

 回到顶部
帅哥,在线噢!
狐狸爸爸
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2011/10/11 7:59:00 [显示全部帖子]

将这些DLL复制到foxtable安装目录,项目的全局代码加上以下代码:

 

Public Declare Function CVR_InitComm Lib "termb.dll" (ByVal Port As Integer) As Short
Public Declare Function CVR_CloseComm Lib "termb.dll" () As Short
Public Declare Function CVR_Authenticate Lib "termb.dll" () As Short
Public Declare Function CVR_Read_Content Lib "termb.dll" (ByVal Active As Integer) As Short
Public Declare Function CVR_Ant Lib "termb.dll" (ByVal mode As Integer) As Short
Public Declare Function GetPeopleName Lib "termb.dll" (ByVal lpReturnedString As String, ByRef nReturnLen As Short) As Short
Public Declare Function GetPeopleAddress Lib "termb.dll" (ByVal lpReturnedString As String, ByRef nReturnLen As Short) As Short
Public Declare Function GetPeopleIDCode Lib "termb.dll" (ByVal lpReturnedString As String, ByRef nReturnLen As Short) As Short
Public  Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As String, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer

 

接下来就可以在foxtable中使用了,例如:

 

Dim strTemp As String
Dim nReturnLen As Short
Dim nReturn As Short
strTemp = Space(255)
nReturn = GetPeopleName(strTemp, nReturnLen)
output.Show(" 姓名: " & strTemp)

 

最好是让对方提供vb.net或C#的实例,这样直接就可以使用了,因为vb和vb.net还是有不同的


 回到顶部
帅哥,在线噢!
狐狸爸爸
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2011/10/11 9:29:00 [显示全部帖子]

全局代码:
 

Public Declare Function CVR_InitComm Lib "termb.dll" Alias "CVR_InitComm" (ByVal Port As Integer) As Integer
Public Declare Function CVR_Authenticate Lib "termb.dll" Alias "CVR_Authenticate" () As Integer
Public Declare Function CVR_Read_Content Lib "termb.dll" Alias "CVR_Read_Content" (ByVal Active As Integer) As Integer
Public Declare Function CVR_CloseComm Lib "termb.dll" Alias "CVR_CloseComm" () As Integer
Public Declare Function GetPeopleName Lib "termb.dll" Alias "GetPeopleName" (ByRef strTmp As Byte, ByRef strLen As Integer) As Integer
Public Declare Function GetPeopleNation Lib "termb.dll" Alias "GetPeopleNation" (ByRef strTmp As Byte, ByRef strLen As Integer) As Integer
Public Declare Function GetPeopleBirthday Lib "termb.dll" Alias "GetPeopleBirthday" (ByRef strTmp As Byte, ByRef strLen As Integer) As Integer
Public Declare Function GetPeopleAddress Lib "termb.dll" Alias "GetPeopleAddress" (ByRef strTmp As Byte, ByRef strLen As Integer) As Integer
Public Declare Function GetPeopleIDCode Lib "termb.dll" Alias "GetPeopleIDCode" (ByRef strTmp As Byte, ByRef strLen As Integer) As Integer
Public Declare Function GetDepartment Lib "termb.dll" Alias "GetDepartment" (ByRef strTmp As Byte, ByRef strLen As Integer) As Integer
Public Declare Function GetStartDate Lib "termb.dll" Alias "GetStartDate" (ByRef strTmp As Byte, ByRef strLen As Integer) As Integer
Public Declare Function GetEndDate Lib "termb.dll" Alias "GetEndDate" (ByRef strTmp As Byte, ByRef strLen As Integer) As Integer
Public Declare Function GetPeopleSex Lib "termb.dll" Alias "GetPeopleSex" (ByRef strTmp As Byte, ByRef strLen As Integer) As Integer

 Public name As StringBuilder
 Public sex As String
 Public people As String
 Public birthday As String
 Public address As String
 Public number As String
 Public signdate As String
 Public validtermOfStart As String
 Public validtermOfEnd As String
 
 
         <StructLayout(LayoutKind.Sequential, Size:=16, CharSet:=CharSet.Ansi)>  _
         Public Structure IDCARD_ALL
             <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=30)>  _
             Public name As Char
             <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=3)>  _
             Public sex As Char
             <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=4)>  _
             Public people As Char
             <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=16)>  _
             Public birthday As Char
             <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=70)>  _
             Public address As Char
             <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=36)>  _
             Public number As Char
             <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=30)>  _
             Public signdate As Char
             <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=16)>  _
             Public validtermOfStart As Char
             <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=16)>  _
             Public validtermOfEnd As Char
         End Structure
 
 
Public Sub FillData()
Try
pictureBox1.ImageLocation = (Application.StartupPath + "\\zp.bmp")
Dim name() As Byte = New Byte((30) - 1) {}
Dim length As Integer = 30
CVRSDK.GetPeopleName(name(0), length)
'MessageBox.Show();
Dim number() As Byte = New Byte((30) - 1) {}
length = 36
CVRSDK.GetPeopleIDCode(number(0), length)
Dim people() As Byte = New Byte((30) - 1) {}
length = 3
CVRSDK.GetPeopleNation(people(0), length)
Dim validtermOfStart() As Byte = New Byte((30) - 1) {}
length = 16
CVRSDK.GetStartDate(validtermOfStart(0), length)
Dim birthday() As Byte = New Byte((30) - 1) {}
length = 16
CVRSDK.GetPeopleBirthday(birthday(0), length)
Dim address() As Byte = New Byte((30) - 1) {}
length = 70
CVRSDK.GetPeopleAddress(address(0), length)
Dim validtermOfEnd() As Byte = New Byte((30) - 1) {}
length = 16
CVRSDK.GetEndDate(validtermOfEnd(0), length)
Dim signdate() As Byte = New Byte((30) - 1) {}
length = 30
CVRSDK.GetDepartment(signdate(0), length)
Dim sex() As Byte = New Byte((30) - 1) {}
length = 3
CVRSDK.GetPeopleSex(sex(0), length)
lblAddress.Text = System.Text.Encoding.GetEncoding("GB2312").GetString(address)
lblSex.Text = System.Text.Encoding.GetEncoding("GB2312").GetString(sex)
lblBirthday.Text = System.Text.Encoding.GetEncoding("GB2312").GetString(birthday)
lblDept.Text = System.Text.Encoding.GetEncoding("GB2312").GetString(signdate)
lblIdCard.Text = System.Text.Encoding.GetEncoding("GB2312").GetString(number)
lblName.Text = System.Text.Encoding.GetEncoding("GB2312").GetString(name)
lblNation.Text = System.Text.Encoding.GetEncoding("GB2312").GetString(people)
lblValidDate.Text = (System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfStart) + ("-" + System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfEnd)))
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub

public  iRetUSB As Integer = 0
public  isClose As Boolean = false
public iRetCOM As Integer = 0
 
窗口的AfterLoad事件:
 
 Try
Dim iPort As Integer
iPort = 1001
Do While (iPort <= 1016)
iRetUSB = CVRSDK.CVR_InitComm(iPort)
If (iRetUSB = 1) Then
Exit For
End If
iPort = (iPort + 1)
Loop
iPort = 1
Do While (iPort <= 4)
iRetCOM = CVRSDK.CVR_InitComm(iPort)
If (iRetCOM = 1) Then
Exit For
End If
iPort = (iPort + 1)
Loop
If ((iRetCOM = 1) _
OrElse (iRetUSB = 1)) Then
 messagebox.show ("初始化成功")
Else
 messagebox.show ("初始化失败")
End If
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try

窗口的BeforeClose事件:
 If Not isClose Then
Try
CVRSDK.CVR_CloseComm
Me.Close
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End If

 
读取按钮事件:
 
 Try
If ((iRetCOM = 1) _
OrElse (iRetUSB = 1)) Then
Dim authenticate As Integer = CVRSDK.CVR_Authenticate
If (authenticate = 1) Then
Dim readContent As Integer = CVRSDK.CVR_Read_Content(4)
If (readContent = 1) Then
    messagebox.show ("成功")
FillData
Else
 messagebox.show ("失败")
End If
Else
MessageBox.Show("没有卡", cn, ")")
End If
Else
'MessageBox.Show("初始化失败")
End If
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try


 

 回到顶部
帅哥,在线噢!
狐狸爸爸
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2011/10/11 9:30:00 [显示全部帖子]

以下是引用擎天柱在2011-10-11 9:16:00的发言:

我用的是华旭金卡,谁有华旭的?麻烦共享一下,谢谢!

华旭官方的开发包是加密打包的,打不开。

另外网上有通用开发包开发的样板,可惜我不会用。

如果foxtable能够引用应用这些通用开发包,那又是一大市场啊!

 

所有都能引用,只要开发商有开发接口。


 回到顶部
帅哥,在线噢!
狐狸爸爸
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2011/10/11 10:02:00 [显示全部帖子]

呵呵,除非你送台设备给我,否则我怎么做啊? 做示例要调试的啊

图片点击可在新窗口打开查看

[此贴子已经被作者于2011-10-11 10:06:53编辑过]

 回到顶部
帅哥,在线噢!
狐狸爸爸
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2011/10/11 16:35:00 [显示全部帖子]

不行的是正常的,这种编程,都要要有实际的设备调试,才能写出100%可行的代码,否则都是蒙。

 回到顶部
帅哥,在线噢!
狐狸爸爸
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2011/10/12 14:42:00 [显示全部帖子]

自行调整,只是大概如此。

 回到顶部
帅哥,在线噢!
狐狸爸爸
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2011/10/12 18:07:00 [显示全部帖子]

呵呵,这东西,没有设备在手,没有办法帮你捉摸的,因为代码和思路都是现成的,我写和你写,都一样。

 


 回到顶部
帅哥,在线噢!
狐狸爸爸
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2011/10/13 8:07:00 [显示全部帖子]

这玩意多钱?

有空我买一个玩玩。


 回到顶部
总数 11 1 2 下一页