Writing-related information management systems, sometimes meet reading and writing-related issues such as external devices, such problems in achieving this kind of functionality PowerBulider is not a difficult task, the relevant external equipment vendors now offer products in basic programming interfaces are provided relevant, after use of these ActiveX controls interface functions, combined with the external function call PowerBulider, can easily achieve the relevant functions to provide read and write IC cards to achieve the following basic code in order to eliminate staff time related to programming external device to write on issues such as fear of
External function declaration:
Subroutine PostPara (long prot, strig syspara) library "lock739.dll" / / pass parameters, the main pass serial information
Function long Reset () library "lock739.dll" / / write reset
Function Boolean OpenCom () library "lock739.dll" / / Open the serial port
Subroutine CloseCom () library "lock739.dll" / / close serial port
Function long ChkCard () library "lock739.dll" / / check card is in place
Function long CmpSc (string sc) library "lock739.dll" / / check password
Function long WriteSc (string sc) library "lock739.dll" / / modify the password encryption card
Function long ReadSc (string inbuff, long sclen) library "lock739.dll" / / degree curve encryption card password
Function long RdDat (long cardtype, long start, long ilen, ref string inbuff) library "lock739.dll" / / reader information
Function long WrDat (long cardtype, long start, long ilen, ref string outbuff) library "lock739.dll" / / write card information
Instance variables:
public string sc = '272272272 '
Write Card function: wf_write (string as_arg1, long al_start, long al_len)
/ * Write the string parameter string as_arg1;
long al_start write position
long al_len write the length of the * /
long l_rtn
if opencom () = false then
messagebox ("prompt", "serial connection failed")
return
end if
l_rtn = chkcard ()
if l_rtn <> 0 then
wf_errormessage (l_rtn)
closecom ()
return
end if
l_rtn = cmpsc (sc) / / sc for the password
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 ("prompt", "write card successfully!")
Card Reader Function: wf_read (string as_arg1, long al_start, long al_len)
/ * Parameter string as_arg1 read information stored string;
long al_start reader into the starting position
the length of long al_len reader * /
long l_rtn
if opencom () = false then
messagebox ("prompt", "serial connection failed")
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 ("prompt", "reader success!")
Error function: wf_errormessage (long lerror)
choose case lerror
case 1
messagebox ("prompt", "write error or password error!")
case 2
messagebox ("prompt", "card has been damaged or parameter bounds!")
case 3
messagebox ("prompt", "Please card!")
case 4
messagebox ("prompt", "communication error!")
case else
messagebox ("prompt", "Unknown error!")
end choose
Initialize the card function wf_initialcard (long al_port)
/ * Parameters: long al_port introduced readers to use the serial port * /
psotpara (al_port, "")
The above example code used by the ic card sle4442 encrypted memory card reader for the wb1000 IC card reader
Through the above code example, the communication with external devices, not a very difficult time right? !
Recommended links:
.swf FileSilver DVD EditorYoutube Movie to Xvid ValueEvaluate File And Disk MANAGEMENTSwift MPEG to xBox 360Ps3 video formatHot Genealogyconvert Avi to ipodLenogo Video To IPhone Converter ProConvert to wmvHow-to Flash to PSPYoutube FLV to 3G2 PackBluesea M4A AAC To M3U ConverterYoutube FLV to BDMV PackSmall Window, Big World Comparative Evaluation Pocket PC 8