当前位置: 代码迷 >> VFP >> 怎么读二代身份证信息(包括照片)
  详细解决方案

怎么读二代身份证信息(包括照片)

热度:7159   发布时间:2013-02-26 00:00:00.0
如何读二代身份证信息(包括照片)
读到表中

------解决方案--------------------------------------------------------
cmdRead_click
=========================
DECLARE integer InitComm IN "termb.dll" integer
DECLARE integer Authenticate IN "termb.dll"
DECLARE integer CloseComm IN "termb.dll"
DECLARE integer Read_Content IN "termb.dll" integer

DECLARE INTEGER GetPeopleName IN "termb.dll" string ,integer
DECLARE integer GetPeopleSex IN "termb.dll" string ,integer
DECLARE integer GetPeopleBirthday IN "termb.dll" string,integer
DECLARE integer GetPeopleAddress IN "termb.dll" string ,integer
DECLARE integer GetPeopleNation IN "termb.dll" string ,integer
DECLARE integer GetPeopleIDCode IN "termb.dll" string,integer
DECLARE integer GetDepartment IN "termb.dll" string,integer
DECLARE integer GetStartDate IN "termb.dll" string,integer
DECLARE integer GetEndDate IN "termb.dll" string,integer
DECLARE integer GetReserve IN "termb.dll" string,integer
DECLARE integer GetPhotoBMP IN "termb.dll" string,integer

LOCAL iPort,cValue,cName,cSex,cBirthday,cAddress,cNation,cIDCode,cDepartment,cStartDate,cEndDate,cReserve,cPhotoBMP
iPort=1001
thisform.clearall()

cValue=InitComm(iPort)
IF cValue<>1
MESSAGEBOX("打开端口失败!")
RETURN
ENDIF

WAIT WINDOW "请刷身份证……" NOWAIT NOCLEAR 
LOCAL nSeconds
nSeconds=SECONDS()
DO WHILE .t.
cValue=Authenticate()
IF cValue=1
EXIT 
ENDIF 
=INKEY(0.1,"H")
IF SECONDS()-nSeconds>10
WAIT CLEAR 
MESSAGEBOX("没有正确读卡!")
RETURN 
ENDIF 
ENDDO
WAIT CLEAR 

Read_Content(1)
Read_Content(2)
Read_Content(3)
Read_Content(5)

cName=SPACE(10)
GetPeopleName(@cName,10)

cSex=SPACE(2)
GetPeopleSex(@cSex,2)

cNation=SPACE(50)
GetPeopleNation(@cNation,50)

cPhotoBMP=SPACE(1000*1024)
GetPhotoBMP(@cPhotoBMP,100*1024)

cBirthday=SPACE(10)
GetPeopleBirthday(@cBirthday,10)

cAddress=SPACE(500)
GetPeopleAddress(@cAddress,500)

cIDCard=SPACE(30)
GetPeopleIDCode(@cIDCard,30)

cDepartment=SPACE(100)
GetDepartment(@cDepartment,100)

cStartdate=SPACE(10)
GetStartDate(@cStartdate,10)

cEndDate=SPACE(10)
GetEndDate(@cEndDate,10)
CloseComm()

thisform.lblname.Caption=ALLTRIM(cName)
thisform.lblsex.Caption=ALLTRIM(cSex)
thisform.lblnation.Caption=ALLTRIM(cNation)
thisform.lblyear.Caption=left(ALLTRIM(cBirthday),4)
thisform.lblmonth.Caption=SUBSTR(ALLTRIM(cBirthday),5,2)
thisform.lblday.Caption=SUBSTR(ALLTRIM(cBirthday),7,2)
thisform.lblAddress.Caption=ALLTRIM(cAddress)
thisform.lblidCard.Caption=ALLTRIM(cIDCard)
thisform.lbldepartment.Caption=ALLTRIM(cDepartment)
thisform.lblcanUseDate.Caption=ALLTRIM(cstartdate)+'----'+ALLTRIM(cenddate)

thisform.Image1.PictureVal=cPhotoBMP
  相关解决方案