Home > database >  Call DLL dynamic problem
Call DLL dynamic problem

Time:10-18

Card reader function description in the following, to open the port function call everything is normal, but the call function of the credit card information has been an error, how do I write is correct, what a great god can give directions, best can detail, thank you,


//social security card and open information
Typedef struct TPublicInfoTag
{
Char cCardNo [9]./* card number */
Char cName [30]./* name */
Char cSex [1]./* */gender
Char cPersonalID [18]. Id/* */
Char cPhone [15]./* phone number */
Char cAddress [80]./* address */
Char cPostCode [6]./*/postal code *
} TPublicInfo;

Function description
Yibao. Within the DLL function description

//open the serial port,
Such as handle=ICC_Reader_Open (" COM1 ");

STDAPI ICC_Reader_Open (BYTE * pCOM);

//close the serial port yibao. DLL
STDAPI ICC_Reader_Close (int ReaderHandle);

Iccdll. Within the DLL function description

//read social security card and open information
STDAPI ReadPublicInfo (int ReaderHandle, TPublicInfo * pInfo);//iccdll. DLL


Above function returns for the int type right is less than 0 error greater than 0

CodePudding user response:

My writing is the fact that the Function declaration: the Function int ReadPublicInfo (int ReaderHandle, ref string pInfo) library "iccdll. DLL
"
String cCardNo, cName, cSex cPersonalID, cPhone, cAddress, cPostCode
Li_i=ICC_Reader_open (" COM4 ")
CCardNo=space (9)
ReadPublicInfo (256, cCardNo)

But the corresponding function type wrong

CodePudding user response:

In front of the other li_i=ICC_Reader_open (" COM4 ") is wrong, don't have to see,

CodePudding user response:

//this statement a try, if not use the blob pb10 later to add other alias ANSI
The Function int ReadPublicInfo (int ReaderHandle, ref char pInfo [159]) library "iccdll. DLL
"
String cCardNo, cName, cSex cPersonalID, cPhone, cAddress, cPostCode
Li_i=ICC_Reader_open (" COM4 ")
Char cCardNo [159]
ReadPublicInfo (li_i cCardNo)

CodePudding user response:

reference xiajinxian reply: 3/f
//try this statement, if not use the blob pb10 later to add other alias ANSI
The Function int ReadPublicInfo (int ReaderHandle, ref char pInfo [159]) library "iccdll. DLL
"
String cCardNo, cName, cSex cPersonalID, cPhone, cAddress, cPostCode
Li_i=ICC_Reader_open (" COM4 ")
Char cCardNo [159]
ReadPublicInfo (li_i cCardNo)

Thank the eldest brother first answer, I study the find an error is reported to handle errors, I use ICC_Reader_Close (int ReaderHandle) to test or report the same mistakes, I am PB8.0 will also add alias ANSI?
For example:
Int li_i
String ls_com
Ls_com="com4"
Ii_handle=ICC_Reader_open (ls_com)
ICC_Reader_close (ii_handle)

Global function ii_handle
Still an error
Bad runtime function reference

CodePudding user response:

Should be mainly the structure of the statement, it is recommended that you try the byte

CodePudding user response:

reference 5 floor lzp_lrp reply:
should be mainly the structure of the statement, I suggest you try the byte

Thank you for your reply, I began to suspect that the API instructions is wrong, notes
//close the serial port yibao. DLL
STDAPI ICC_Reader_Close (int ReaderHandle);
So as long as I stated
The Function int ICC_Reader_close (int ReaderHandle) library "yibao. DLL
"Call li_i=ICC_Reader_close (123)
Will feedback the number of less than zero, and won't to bad runtime function reference error!

CodePudding user response:

The second parameter is the type of structure
  • Related