Home > Back-end >  Delphi call SCardEstablishContext, compile without error, an error when performing
Delphi call SCardEstablishContext, compile without error, an error when performing

Time:09-17

The unit Unit1;

Interface

USES the
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

Type
TForm1=class (TForm)
For: TButton;
Edit1: TEdit;
Procedure Button1Click (Sender: TObject);
Private
{Private declarations}
Public
{Public declarations}
end;

Var
Form1: TForm1;
The function SCardEstablishContext (dwScope: LongInt; PvReserved1: Pointer; PvReserved2: Pointer; PhContext: Thandle) : LongInt; Stdcall; External 'WinSCard. DLL';

Implementation

{$R *. DFM}

Procedure TForm1. Button1Click (Sender: TObject);

Var
Ret: LongInt;
HSC: Thandle;

The begin
Ret:=SCardEstablishContext (0, nil nil, hSC);
If ret & lt;> 0 then
Edit1. Text:='false'
The else
Edit1. Text:='true';
end;

End.
Error message
'Access violation at address 0042 f838 module in' Project1. Exe ', the read of address CD00FFEC
'
Again by the way to use Delphi do a read M1 card program, using the Smart card related functions can be achieved?



CodePudding user response:

It is very urgent, I am a small white the great spirit guide

CodePudding user response:

Handle direct with no value?
  • Related