nusb = 1001
zp=m.mypath+"\sfzzp\"
dkPath =m.mypath+"\SynIDCardAPI.dll"
SET DEFA TO(m.mypath)
LOCAL lcText ,lcpucIIN,lcpucSN,test
m.sfztxt = SPACE(1280)
m.lcpucIIN = SPACE(4)
m.lcpucSN = SPACE(8)
m.test=SPACE(255)
*!* DELETE FILE mypath+"\data\temp.txt"
**--端口控制
DECLARE INTEGER Syn_OpenPort IN (dkPath) INTEGER
DECLARE INTEGER Syn_ClosePort IN (dkPath) INTEGER
**--
**--寻卡与读卡
DECLARE INTEGER Syn_StartFindIDCard IN (dkPath) INTEGER,STRING @,INTEGER
DECLARE INTEGER Syn_SelectIDCard IN (dkPath) INTEGER,STRING @,INTEGER
DECLARE INTEGER Syn_ReadMsg IN (dkPath) INTEGER,INTEGER,STRING @
DECLARE INTEGER Syn_SetPhotoPath IN (dkPath) INTEGER,STRING @
DECLARE INTEGER Syn_SetPhotoType IN (dkPath) INTEGER
DECLARE INTEGER Syn_SetPhotoName IN (dkPath) INTEGER
LOCAL loMsg AS COLLECTION
loMsg = CREATEOBJECT("Collection")
IF Inita()
IF Syn_OpenPort(nUSB) =0
=Syn_StartFindIDCard(nUsb,@lcpucIIN,0)
=Syn_SelectIDCard(nUsb,@lcpucSN,0)
=Syn_SetPhotoPath(2,@zp)
=Syn_SetPhotoType(1)
=Syn_SetPhotoName(2)
Syn_ReadMsg(nUsb,0,@m.sfztxt)
IF LEN(ALLTRIM(m.sfztxt))>0 THEN
*!* IF Syn_ReadMsg(nUsb,0,@m.sfztxt) =0
*!* STRTOFILE(lcText,mypath+"\data\temp.txt")
ELSE
zttxt="读身份证失败!"
m.dqzt=.F.
ENDIF
Syn_ClosePort(nUsb)
ELSE
zttxt="打开端口失败!"
m.dqzt=.F.
ENDIF
ENDIF
*!* MESSAGEBOX("姓名:"+qk(SUBSTR(m.lcText,1,32)))
*!* MESSAGEBOX("性别:"+SUBSTR(m.lcText,33,1))
*!* MESSAGEBOX("性别:"+SUBSTR(m.lcText,39,2))
*!* MESSAGEBOX("出生日期:"+SUBSTR(m.lcText,59,8))
*!* MESSAGEBOX("地址:"+SUBSTR(m.lcText,77,72))
*!* MESSAGEBOX("身份证号:"+SUBSTR(m.lcText,149,18))
*!* MESSAGEBOX("发证:"+qk(SUBSTR(m.lcText,187,32)))
*!* MESSAGEBOX("开始:"+SUBSTR(m.lcText,219,8))
*!* MESSAGEBOX("结束:"+SUBSTR(m.lcText,237,8))
PROCEDURE DLLS
**----
ENDPROC
PROCEDURE inita
*//初始化读卡器
LOCAL i,lnReutls
DLLS()
lnReutls =.F.
FOR i=1001 TO 1017
IF Syn_OpenPort(i)=0
Syn_ClosePort(i)
lnReutls =.T.
nUsb =i
zttxt="读卡器连接在"+STR(i,4)+"USB口上"
EXIT
ENDIF
ENDFOR
IF !lnReutls
zttxt="打开端口失败!"
m.dqzt=.F.
ENDIF
RETURN lnReutls
ENDPROC