在PowerBulider中读写IC卡
来源:互联网 发布:mac 怎么安装anaconda 编辑:程序博客网 时间:2024/05/21 09:35
在写相关的信息管理系统时,有时会遇见读写相关的外部设备等问题,这类的问题,在PowerBulider中实现这类的功能并不是一件难事,现在的相关外部设备厂商在提供产品时,基本都提供了相关编程接口,利用这些接口函数后ActiveX控件,结合PowerBulider中外部函数的调用,可以轻松的实现相关功能,以下提供读写IC卡实现的基本代码,以期消除相关编程人员对读写外部设备等问题的恐惧心理
外部函数声明:
Subroutine PostPara(long prot,strig syspara) library “lock739.dll”//传递参数,主要传递串口信息
Function long Reset() library “lock739.dll”//读写复位
Function Boolean OpenCom () library “lock739.dll”//打开串口
Subroutine CloseCom() library “lock739.dll”//关闭串口
Function long ChkCard() library “lock739.dll”//检查卡是否到位
Function long CmpSc(string sc) library “lock739.dll”//核对密码
Function long WriteSc(string sc) library “lock739.dll”//修改加密卡密码
Function long ReadSc(string inbuff,long sclen) library “lock739.dll”//度曲加密卡密码
Function long RdDat(long cardtype,long start,long ilen,ref string inbuff) library “lock739.dll”//读卡信息
Function long WrDat(long cardtype,long start,long ilen,ref string outbuff)library “lock739.dll”//写卡信息
实例变量:
public string sc=’272272272’
写卡函数:wf_write(string as_arg1,long al_start,long al_len)
/*参数 string as_arg1 写入的字符串;
long al_start 写入的位置
long al_len 写入的长度*/
long l_rtn
if opencom()=false then
messagebox(“提示”,”串口连接失败”)
return
end if
l_rtn=chkcard()
if l_rtn<>0 then
wf_errormessage(l_rtn)
closecom()
return
end if
l_rtn=cmpsc(sc)//sc为密码
if l_rtn<>0 then
wf_errormessage(l_rtn)
closecom()
return
end if
l_rtn=wrdat(1,al_start,al_len,as_agr1)
if l_rtn<>0 then
wf_errormessage(l_rtn)
closecom()
return
end if
messagebox(“提示”,”写卡成功!”)
读卡函数:wf_read(string as_arg1,long al_start,long al_len)
/*参数 string as_arg1 保存读出信息的字符串;
long al_start 开始读卡入的位置
long al_len 读卡的长度*/
long l_rtn
if opencom()=false then
messagebox(“提示”,”串口连接失败”)
return
end if
l_rtn=chkcard()
if l_rtn<>0 then
wf_errormessage(l_rtn)
closecom()
return
end if
l_rtn=rddat(1,al_start,al_len,as_agr1)
if l_rtn<>0 then
wf_errormessage(l_rtn)
closecom()
return
end if
messagebox(“提示”,”读卡成功!”)
显示错误函数:wf_errormessage(long lerror)
choose case lerror
case 1
messagebox(“提示”,”写入错误或密码错误!”)
case 2
messagebox(“提示”,”卡已损坏或参数越界!“)
case 3
messagebox(“提示”,”请插卡!”)
case 4
messagebox(“提示”,”通讯错误!”)
case else
messagebox(“提示”,”未知错误!”)
end choose
初始化卡函数wf_initialcard(long al_port)
/*参数:long al_port 传入读写器使用的串口*/
psotpara(al_port,””)
以上的例子代码所使用的ic卡为sle4442 加密存储器卡,读卡器为wb1000 IC卡读写器
通过以上代码的示例,实现与外部设备的通讯,并不是一件很难的事吧?!
- 在PowerBulider中读写IC卡
- 在PowerBulider中读写IC卡
- 在PowerBulider中读写IC卡
- 在PowerBulider中读写IC卡
- IC卡读写
- IC 卡读写程序
- PB读写IC卡
- 【IC卡读写】
- IC卡读写
- IC卡读写
- IC卡读写器技术及应用
- IC卡读写器c#源代码
- IC卡读写器c#源代码
- IC卡读写器c++builder源代码
- IC卡读写器DELPHI源代码
- IC卡读写器VB.NET源代码
- IC卡读写器VB源代码
- DM8168外挂IC卡读写异常
- Google Site Ban Checker
- 制作更方便的下拉菜单
- 反对台独
- summary
- VFP中使用浏览器控件制软件界面
- 在PowerBulider中读写IC卡
- 《疯狂的石头》经典台词和镜头大全 评论
- vector入门
- SKYPE的噩梦才刚刚开始
- Flex Builder 2以及Charting注册码
- 软件用户界面设计风格
- uClinux系统分析
- 另类DATAGRID数据编辑修改 datagrid .asp.net
- eclipse 与 myEclipse