Home > database >  Call DLL in PB (about the IC card operation)
Call DLL in PB (about the IC card operation)

Time:09-18

The following is a Delphi interface calling code:
Const
='PReadcardDll YQSHDLL. DLL';
Type
TCardMessage=array [0.. 15] of byte;//16 bytes IC fast data
PCardMessage=^ TCardMessage;//pointer
End
Dynamic library function declaration
The function ReadICCard (Sector: integer; CardM: pCardMessage; ACom: integer) : integer; StdCall; External YQSHDLL;

Button events (according to the code to read a sector 0,1,2 block data)
Procedure TForm2. Button10Click (Sender: TObject);
Var
I: Integer;
Pb: TCardMessage;
As_TempStr: string;
The begin
If not SetReadPram (setor, 0, PChar (password), Comport) then
The begin
Application. MessageBox (' password wrong ', 'prompt', MB_OK);
The Exit;
end;
ReadICCard (0, @ pb, Comport);
As_TempStr:=';
For I:=0 to 15 do
As_TempStr:=as_TempStr + IntToHex (pb [I], 2);
Edit24. Text:=as_TempStr;
ReadICCard (1, @ pb, Comport);
As_TempStr:=';
For I:=0 to 15 do
As_TempStr:=as_TempStr + IntToHex (pb [I], 2);
Edit19. Text:=as_TempStr;
ReadICCard (2, @ pb, Comport);
As_TempStr:=';
For I:=0 to 15 do
As_TempStr:=as_TempStr + IntToHex (pb [I], 2);
Edit20. Text:=as_TempStr;
end;

To ask, this paragraph of the program code in the PB how to implement and calls, said colleagues directly with PB is bad to do, to Delphi change under dynamic library function is used to derive a new DLL file to use PB (implementation is a function of the Delphi original packaging again, change on the type of return value), many thanks!

CodePudding user response:

Ah, this post for a long time, do not understand, help,

CodePudding user response:

We can use DELPHI call basic use PB calls!

CodePudding user response:

The Public Function int ReadICCard (int Sector, ref char CardM [], int aCom) LIBRARY "PReadcardDll. DLL
"Call, first:
For I=1 to 16
CardM [I]=char (0)
next
  • Related