DLL and object in CPIC (prototype is M1card. CPIC)
Procedure InitCard (const Key Code: WideString; Sector, CtCode: Integer); Safecall;
The function ReadCardInfo (var DataFlag: Integer; Var CardData: TCardData) : Integer; Safecall;
DataFlag: return error on behalf of
CardData: charge sector data
TCardData=https://bbs.csdn.net/topics/record
Balance: Double;//card amount (4 bytes)
BtDate: WideString;//subsidies logo (written into the card, date of subsidies, prevent repeated to receive 3 bytes) used to read
The Timer: WideString;//timing (5 bytes) used to read
LimitMoney1: WideString;//limit (3 bytes) do not fill out or fill in "000000"
LimitTimes1: Integer;//indefinitely (1 byte)
OrderTime: WideString;//reservation time (2 bytes) used to read
OrderRecord: WideString;//reservation record (4 bytes) used to read
UseTimes: Integer;//use (3 bytes) decimal
WriteFlag: Integer;//write card logo (1 byte) used to read
end;
I also declare a person structure is s_carddata in PB, the calling code is as follows:
Long code, RTN, ctcode
The string key, code
S_carddata carddata
OleObject obj
Obj=Create OleObject
Obj. ConnectToNewObject (" M1card. CPIC ")
Obj. InitCard (Key Code, 1, ctcode)//this call normal
RTN=obj. ReadCardInfo (code, carddata)//the wrong line call, error code 35
.
I also tried not use ole, but directly in the local external functions provides a statement function
The function long ReadCardInfo (ref long flag, ref s_carddata carddata) library "M1card. DLL
"So call will prompt the error code 15
So, preliminary judgment this DLL can only be invoked by means of ole, this sentence obj ReadCardInfo (code, carddata), may be passed carddata structure parameter error,
Consult everybody how should handle?
CodePudding user response:
Problems should be defined in the structure type, do not use an int in the pb, with a longOr
Obj. ReadCardInfo (code, ref carddata)
CodePudding user response:
In PB, the definition of structure, int has been to long, double constant, widestring converted to stringObj. ReadCardInfo (code, ref
carddata)Call, also tried to add ref and not add ref, is the same error
Obj. InitCard (Key Code, 1, ctcode)//this call normal
RTN=obj. ReadCardInfo (code, carddata)//the wrong line call
The calls to normal, not used structure parameters, call is normal, the next line used carddata structure, call is wrong
CodePudding user response: