0% found this document useful (0 votes)
305 views99 pages

SCardX Manual Delphi7

xcard with delphi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
305 views99 pages

SCardX Manual Delphi7

xcard with delphi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 99

SCardX Easy

Smart Card ActiveX control


Version 1.3

Smart Cards in the


Delphi applications

Developers Manual

Document ver.1.4
Dec. 22, 2005

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual.

Copyright 2005 by SCardSOFT

All rights reserved. No parts of this work may be reproduced in any form or by any means - graphic, electronic, or
mechanical, including photocopying, recording, taping, or information storage and retrieval systems - without the
written permission of the author.

Products that are referred to in this document may be either trademarks and/or registered trademarks of the
respective owners. The publisher and the author make no claim to these trademarks.

While every precaution has been taken in the preparation of this document, the publisher and the author assume no
responsibility for errors or omissions, or for damages resulting from the use of information contained in this document
or from the use of programs and source code that may accompany it. In no event shall the publisher and the author be
liable for any loss of profit or any other commercial damage caused or alleged to have been caused directly or
indirectly by this document.

Printed: Dec. 22, 2005

Thank You for your interest to the SCardX Easy smart card
ActiveX control!
Publisher
Please send me all your suggestions or any questions about the
SCardX Easy smart card ActiveX control via e-mail
[email protected].
SCardSOFT
Visit our web site for the latest software and specifications
updates.
h ttp :/ /ww w.s ca rd so ft. co m
in fo@ s ca rd so ft. co m
Yours,
Igor V. Kharchenko
author.
Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Contents

Table of Contents
Part I About 4
1 About SCardX
...................................................................................................................................
Easy ActiveX control 4

2 Contacts ................................................................................................................................... 4

Part II SCardX Easy ActiveX control


overview 5
1 What is the...................................................................................................................................
SCardX Easy? 5
SCardX Easy
. ... ....
is ....
an...ActiveX
.... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .......... 5
What SCardX
. ... ....
Easy
.... ...can
.... ...to
.... add
... .... ....
into... ....
your... ....application?
... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .......... 5
Smart cards
. ...in
....your
.... ... ....
applications
... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .......... 5
2 Appearance
................................................................................................................................... 6
States page
. ... .... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .......... 6
Events History
. ... ....page
.... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .......... 8
ToolBar panel
. ... .... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .......... 8
StatusBar panel
. ... .... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .......... 9
3 Smart card
...................................................................................................................................
functionality 10
Smart card
... ...
service
.... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 10
Events ... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 10
Data sending
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 11
4 Additional
...................................................................................................................................
tools 11
LookUp service
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 11
Data ciphering
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 12
Tray Icon ...
usage
... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 12
Preferences
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 12

Part III SCardX Easy first start 14


1 Registering
...................................................................................................................................
SCardX Easy ActiveX control on the Delphi 7 IDE components palette 14

2 Your first...................................................................................................................................
application and the connection testing 16

Part IV Your first application. " Hello,


cards World ! " 21
1 Demo application
................................................................................................................................... 21

2 New Delphi
...................................................................................................................................
project 22

3 Interface ...................................................................................................................................
functions 22

4 Events ................................................................................................................................... 24

5 Preparing...................................................................................................................................
the connection controls 27

6 Preparing...................................................................................................................................
the opened reader controls 29

7 Tray Icon................................................................................................................................... 34

8 LookUp service
................................................................................................................................... 38

9 Data ciphering
................................................................................................................................... 39

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Contents

10 Card detecting
...................................................................................................................................
defaults 40

11 Configuring
...................................................................................................................................
the application startup 42

12 Configuring
...................................................................................................................................
the application shutdown 43

13 Tell : - " Hello,


...................................................................................................................................
cards World ! " 43

Part V SCardX Easy interface


specification 47
1 Properties
................................................................................................................................... 47
ActivePage... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 47
BorderStyle
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 49
BorderWidth
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 49
ConnectionState
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 51
EventsHistoryEnabled
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 51
EventsLogging
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 52
SeparateReceivedBytes
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 52
SmartCardService
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 53
Visible ... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 53
VisibleEventsHistory
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 54
VisibleStatusBar
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 55
VisibleToolBar
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 55
VisibleTrayIcon
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 56
2 Functions................................................................................................................................... 57
DES_DecryptString
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 58
DES_EncryptString
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 58
EventsHistoryClear
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 59
Finalize ... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 60
GetCardATR
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 60
GetCardInfo
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 61
GetCardInfoFmt
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 61
GetEventsHistory
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 63
GetReaderInfo
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 64
GetReaderInfoFmt
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 64
GetReadersList
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 65
IsCardReady
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 66
IsLocked ... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 66
LookUpError
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 67
LookUpReaderState
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 67
ReopenReader
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 69
SendCardAPDU
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 69
SendCardDATA
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 71
SetPref_PCSC_OnCardDetect
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 72
TrayIconMenuClear
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 73
TrayIconMenuCreate
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 74
TrayIconMenuItemSetChecked
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 75
TrayIconMenuItemSetDefault
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 76
TrayIconMenuItemSetEnabled
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 77
Version ... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 78
VersionMajor
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 78
VersionMinor
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 79
3 Events ................................................................................................................................... 80
OnCardDetected
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 80
OnCardInvalid
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 81
OnCardReady
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 81

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Contents

OnCardWait
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 82
OnConnected
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 83
OnDataSent
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 84
OnDisconnected
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 84
OnERROR... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 84
OnHistoryEvent
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 86
OnLock ... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 86
OnReaderSelected
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 87
OnReadersList
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 87
OnReaderStateChanged
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 88
OnTrayIconDblClick
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 89
OnTrayIconMenuItem
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 89
OnUnlock... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 90

Part VI Registration 91
1 Unregistered
...................................................................................................................................
version limitations 91

2 Licensing................................................................................................................................... 91
End-User ...
Licenses
... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 91
Developers
... ...Licenses
.... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 92
Custom versions
... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 93
3 Registration
...................................................................................................................................
steps 94
Step 1 : License
... ... .... ...Query
.... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 94
Step 2 : Purchasing
... ... .... ... .... ...the
.... ...
License
.... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 94
Step 3 : Certificate
... ... .... ... ....registration
... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ... .... ... .... .... ... .... ... .... ........ 94

Copyright 2005 by SCardSOFT


4 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) About

1 About

1.1 About SCardX Easy ActiveX control

SCardX Easy
Smart Card ActiveX control

Version 1.3

Copyright 2005 by SCardSOFT

1.2 Contacts

The official web site of SCardX Easy is the SCardSOFT homepage:

useful SCardSOFT pages:

SCardX Easy official web page

SCardSOFT Home

Smart Cards specifications Library page

Smart Cards Forum ( English )


Smart Cards Forum ( Russian )

Prices page
License's purchasing info page

contact e-mail addresses:

[email protected] - common questions;


[email protected] - payments and licenses questions;
[email protected] - support service;

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy ActiveX control overview 5

2 SCardX Easy ActiveX control overview

2.1 What is the SCardX Easy?


2.1.1 SCardX Easy is an ActiveX

SCardX Easy is a standart ActiveX control.

If your development environment (IDE) supports the ActiveX technology like the MS Visual
Studio, Borland Delphi or C++ Builder or other - than the SCardX Easy may be successfully used
by your applications.

2.1.2 What SCardX Easy can to add into your application?

SCardX Easy adds to your applications the following functionality:

smart cards functionality :

receiving the smart card service's and devices' events;


receiving an information about the attached devices;
receiving an information about the opened smart card;
sending the command data buffers into the opened smart cards and receiving the cards
responses;
managing the cards opening and closing modes;

additional useful tools :

Error LookUp and Reader States LookUp services


Data ciphering
Tray Icon usage

2.1.3 Smart cards in your applications

The SCardX Easy ActiveX control creates the communication channel between the parent
application and an opened smart card via the smart card service and any attached PC/SC
compatible smart card reader.

The SCardX Easy allows you to send the command data buffers into any ISO-7816 compatible
smart cards and to receive the cards' answers.

Using SCardX Easy ActiveX control you can talk with a smart card using card's "native" language -
the language of the command APDU's. It is the lowest level of work with smart cards from the PC.

Using SCardX Easy ActiveX control you can send into your cards any commands according to the
cards' specifications easy and without any limitations.

Copyright 2005 by SCardSOFT


6 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy Acti veX control overview

2.2 Appearance
2.2.1 States page

The "States" page is a main user interface element of the SCardX Easy ActiveX control.

There are many useful information and context pop-up menu commands on this page:

Smart card service info:

selected smart card service


service connection state

Your License info:

License owner's name and address


License number
License type
License usage rules

Preferences:

PC/SC Card detecting defaults

Open the reader automatically : Yes, No


Preferred Protocol: T0, T1, RAW, Autodetect, Undefined
Preferred Sharing Mode: Share reader, Exclusive use, Direct reader control
Card closing mode: Live card, Reset card, Unpower card, Eject card

Miscellaneous

Separate received HEX bytes : Yes, No


Events logging : Log all events, Log most useful events only

Attached devices' list:

Device state
Device info

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy ActiveX control overview 7

Opened smart card info:

ATR
Protocol
Sharing mode
Card info

Error

The last error info

This page has the context pop-up menu which allows you to take access to many useful
commands depending to the selected item.

Copyright 2005 by SCardSOFT


8 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy Acti veX control overview

2.2.2 Events History page

This page contents the archive of the events which was occured.

Fields

N - the serial number of the event;


Source - event source;
Event - event message;
Value - event value (if present);
Event Time - the time when the event was occured;

Pop-up Menu Commands

First Event - go to a first record;


Last Event - go to a last record;
Events logging - the logging mode : Log all events, Log most useful events only
Save Events History - save grid data to a text file;
Copy Events History - copy grid data to a Windows Clipboard;
Clear All - clear all events messages at once;

Useful info:
you can hide/show this page by operating of the VisibleEventsHistory property;
you can read the Events History grid data to your application by calling the function
GetEventsHistory ;
you can clear the Events History grid data by calling the function EventsHistoryClear ;
you can lock/unlock the events logging by operating of the EventsHistoryEnabled property.

2.2.3 ToolBar panel

The ToolBar panel contain the controls for the data sending.

Using the ToolBar you can prepare and send into an opened smart card the control APDU's.

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy ActiveX control overview 9

Or you can prepare and send into an opened smart card the unformatted data buffers.

The ToolBar may be used for testing of the smart card service connection or your device from any
temporary application because it is ready for data sending at once after adding the SCardX Easy
to your application.

If you don't need the ToolBar into your main application you can hide it easy.

Useful info:

you can hide/show the ToolBar by operating of the VisibleToolBar property;

2.2.4 StatusBar panel

The StatusBar is an indicator of the activity of the data exchange process between the SCardX
Easy and a smart card service.

If the control is locked the Led is On.

Copyright 2005 by SCardSOFT


10 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy Acti veX control overview

When the control is not locked the Led is Off.

Useful info:

you can hide/show the StatusBar by operating of the VisibleStatusBar property;

2.3 Smart card functionality


2.3.1 Smart card service

The smart card service is a drivers' layer which is used by SCardX Easy for communication with a
smart card.

Each card readers' manufacturer supports its devices by its own drivers' set.

However the last versions of the Microsoft Windows OS supports its own smart card service based
on the PC/SC standard. The Microsoft PC/SC smart card service allows to any applications to work
with smart cards independent to the hardware drivers.

Today SCardX Easy supports the MS Smart Card Service (PC/SC Interface) and it works with
any of PC/SC compatible smart card readers.

The next versions of SCardX Easy will additionally support some another alternative smart card
services .

Useful info:

you can select the smart card service by operating of the SmartCardService property;
you can connect SCardX Easy to the selected service or disconnect it by operating of the
ConnectionState property;

2.3.2 Events

The SCardX Easy allows to your application to receive all possible events from the selected smart
card service:

User interface events

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy ActiveX control overview 11

OnHistoryEvent
OnReaderSelected
OnTrayIconDblClick
OnTrayIconMenuItem

Smart card work events

OnCardDetected
OnCardInvalid
OnCardReady
OnCardWait
OnConnected
OnDataSent
OnDisconnected
OnReadersList
OnReaderStateChanged

Other events

OnERROR
OnLock
OnUnlock

2.3.3 Data sending

The SCardX Easy allows to your application to send the data into a card and to receive the card
answers.

The data sending functions are:

SendCardAPDU : sending the command APDU's;


SendCardDATA : sending unformatted data buffers;

Before the data sending your application must prepare the sending data in the hexadecimal format
according to the specification of your card.

After calling both these functions returns the hexadecimal data buffer of the card answer on the
sent data.

You may analyze the card answers according to the cards' specifications.

2.4 Additional tools


2.4.1 LookUp service

The SCardX Easy allows to your application to use the following LookUp services:

Error LookUp : decodes any error code from it number value to the text string;
State LookUp : decodes and unpacks the readers' state code from it number value to the text
string;

Copyright 2005 by SCardSOFT


12 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy Acti veX control overview

2.4.2 Data ciphering

The SCardX Easy allows to your application to encode and to decode the text strings using the
DES algorithm.

The DES ciphering functions are:

DES_EncryptString : for encrypting the text;


DES_DecryptString : for decrypting text from an encrypted hex data buffer;

2.4.3 Tray Icon usage

The SCardX Easy has its own icon in the system tray zone.

By default this icon has single pop-up menu item "About...".

You can expand this pop-up menu by adding of your own menu items at any time.

The SCardX Easy allows you to add any counts of your own menu items.

Useful info:

you can re-create the TrayIcon's menu by calling the TrayIconMenuCreate function;
you can clear all menu items of the TrayIcon at once by calling the TrayIconMenuClear function;
you can check/uncheck the menu item by calling the TrayIconMenuItemSetChecked function;
you can enable/disable the menu item by calling the TrayIconMenuItemSetEnabled function;
you can make the menu item as a default item by calling the TrayIconMenuItemSetDefault function;
when the user clicks on the TrayIcon menu item the event OnTrayIconMenuItem occurs;
when the user twice clicks on the TrayIcon the event OnTrayIconDblClick occurs;

2.4.4 Preferences

The SCardX Easy allows you to change the preferences via its ActiveX interface.

PC/SC Card detecting defaults

Using the SetPref_PCSC_OnCardDetect function you can set up of the following preferences:

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy ActiveX control overview 13

Open the reader automatically


Preferred Protocol
Preferred Sharing Mode
Card closing mode

Miscellaneous

Using the SeparateReceivedBytes property you can set up the "Separate received HEX bytes"
parameter of the control's preferences.

Using the EventsLogging property you can set up the "Events logging" parameter of the control's
preferences.

Copyright 2005 by SCardSOFT


14 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy first start

3 SCardX Easy first start

3.1 Registering SCardX Easy ActiveX control on the Delphi 7 IDE


components palette

Open the Delphi IDE main menu Component and click on the item "Import ActiveX Control..."

Select the "SCardX Easy ActiveX Control" string in the controls' list of the window "Import ActiveX"

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy first start 15

Please do not change the class name "TSCardX_Easy" because this name is used by our Delphi7
demo application.

Define the name of the component palette "Palette Page" where Delphi will place the component
icon.

Click on the "Install" button.

The window "Import ActiveX" will be closed and the window "Install" will be opened.

Define the components package where Delphi will insert a new component and click on the "Ok"
button.

The window "Install" will be closed and the window "Package" will be opened.

Click on the "Install" button.

The window "Package" will be closed and the new ActiveX component will be created on the
Delphi's components palette.

Copyright 2005 by SCardSOFT


16 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy first start

You can use now the SCardX Easy ActiveX control as a Delphi component in the your
applications.

3.2 Your first application and the connection testing

You can create the first small application for testing of the smart card service and card readers of
your PC .

Please create the new Delphi application. Drag the SCardX_Easy icon from the components
palette and drop it on the new form.

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy first start 17

Set up the VisibleToolBar property of the SCardX Easy to true.

Go to the Form1.OnClose event and place the following command there:

procedure TForm1.FormClose (Sender: TObject; var Action: TCloseAction);


begin
SCardX_Easy1.Finalize ;
end;

Run it.

Click on the "Service" item of the "States" page of the SCardX Easy by the right mouse button and
select the menu item "Connect ":

Copyright 2005 by SCardSOFT


18 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy first start

The SCardX Easy ActiveX control will try to connect the MS Smart Card service.

If these drivers are present on your PC the SCardX Easy ActiveX control will connect its and the
available card readers names list will be shown.

Insert the standart ISO-7816 smart card like the GSM SIM into the reader.

Warning! Do not use any memory cards for this test!

If the card is valid it will be opened and the info about of this card will be shown on the "States"
page.

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy first start 19

Click on the highlighted reader item.


Open the "Events History" page.
Click on the "Send APDU " button of the ToolBar panel.

If the data will be sent into the card correctly:


the event "Data sent" will be occured and placed into the events history grid;
the received card answer will be placed into the "Received data" controls of the ToolBar
panel;
Otherwise an error event will be created and placed into the events history grid.

Copyright 2005 by SCardSOFT


20 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy first start

That's all.

If you can send now the data buffers into your cards you may start to create your first smart cards
application.

If an error event will be occured during of this test it means that either the smart card service on the
your PC is not started or your devices are not works. In this case you can contact the SCard
SOFT's support service via e-mail [email protected] for detecting and removing the troubles.

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your first appli cation. " Hell o, cards World ! " 21

4 Your first application. " Hello, cards World ! "

4.1 Demo application

The SCardX Easy setup program installs the source codes of example applications.

The default examples' path on your hard drive after control's installation is:

"C:\Program Files\SCardSOFT\SCardX Easy\- Examples"

You can find the Delphi 7 demo application source codes on the following default path:

"C:\Program Files\SCardSOFT\SCardX Easy\- Examples\Borland Delphi 7"

The compiled demo application looks like on this picture:

This demo application will be used by this Manual as a base of your first smart cards Delphi
application.

Please find it and copy its source codes to your Delphi projects workplace.

Copyright 2005 by SCardSOFT


22 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your fi rst application. " Hello, cards World ! "

4.2 New Delphi project

1. Create the new Delphi project.


2. Rename the form from Form1 to MainForm.
3. Drag the SCardX_Easy icon from the components palette and drop it on the new form.
4. Rename the SCardX Easy from SCardX_Easy1 to SCardX_Easy.
5. Set up the control's position on the form.

4.3 Interface functions

You need to control the states of the form's controls depending to the states of the connection and
to your readers' states.

For example the data sending command button must be disabled while the reader is empty.

For managing of the controls' states you need to control the values of the following three SCardX
Easy ActiveX control properties:

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your first appli cation. " Hell o, cards World ! " 23

ConnectionState
IsLocked
IsCardReady

When one of these properties becomes changed you need enable or disable some of the form's
controls.

The demo application has two interface functions:

// enable/disable the controls of the connection oriented commands


procedure TMainForm.EnableControls;
var bb,ll:boolean;
begin
try
ll := (not SCardX_Easy.IsLocked ); // not locked
bb := (SCardX_Easy.ConnectionState=stServiceConnected ); // connected

Button2.Enabled := (not bb) and ll; // enabled when not locked and not connected
Button3.Enabled := bb and ll; // enabled when connected and not locked
Button4.Enabled := bb and ll; // enabled when connected and not locked
ReadersList.Enabled := bb and ll; // enabled when connected and not locked
// .... any another control here
// .... any another control here
// ....

finally
EnableCardControls;
end;
end;

// enable/disable the controls of the smart card commands


procedure TMainForm.EnableCardControls;
var bb,ll:boolean;
wReaderName:widestring;
begin
try
wReaderName := ReadersList.Text;
bb := SCardX_Easy.IsCardReady(wReaderName);
ll := ( not SCardX_Easy.IsLocked );

Button5.Enabled := bb and ll; // enabled when the card is opened and not locked
Button6.Enabled := bb and ll; // enabled when the card is opened and not locked
Button7.Enabled := bb and ll; // enabled when the card is opened and not locked
Button8.Enabled := bb and ll; // enabled when the card is opened and not locked
Button9.Enabled := bb and ll; // enabled when the card is opened and not locked
Button10.Enabled := bb and ll; // enabled when the card is opened and not locked
// .... any another control here
// .... any another control here
// ....

finally
end;
end;

Call the function EnableControls on the following events:

OnConnected
OnDisconnected
OnLock
OnUnlock

The EnableControls function calls the EnableCardControls function automatically. But you need to
call it additionally on the following events:

OnCardWait
OnCardReady
OnReaderSelected

Copyright 2005 by SCardSOFT


24 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your fi rst application. " Hello, cards World ! "

And additionally you need to call the EnableCardControls function each time when the active
reader name of your application will be changed. In the demo application this function additionally
calls on the ReadersList.OnChange event.

4.4 Events

How to receive the smart cards' or the service's events into your own application?

It's so easy by using of the SCardX Easy ActiveX control!

Just select the SCardX_Easy in the ObjectInspector and go to the its Events page. There are all
our control's events there. Double click on the event which you need and the Delphi will create the
source code for you automatically.

Here all used in the demo application events:

All SCardX Easy ActiveX control events are maximal informative. There are all info which you
need are present in the event's parameters.

For example OnCardReady event :

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your first appli cation. " Hell o, cards World ! " 25

procedure TMainForm.SCardX_Easy CardReady( ASender: TObject;


var ReaderName, ATR: WideString;
var ProtocolValue: Integer;
var Protocol: WideString );
begin
// .... your code here
end;

The OnCardReady event gives you all useful information about the opened card at once:
the opened card's Reader Name;
the ATR of the opened card;
the real active Protocol of the opened card.

Any smart card application without the events are dead and unusable.

Otherwise by using the SCardX Easy ActiveX control you can add to your programs the power and
sensitivity of the professional applications.

Processing of the received events


Each event has its own parameters list and each event is intended for its own task.

Additionally to the specific events' tasks the demo application has special controls and procedures
for the simple visualization of all received events :

These events visualization tools are the Memo control and the AddEvent function:

procedure TMainForm.AddEvent(eType, eMessage: string);


var ss:string;
begin
try
if (eMessage>'')
then ss:=' : '
else ss:='';
Memo.Lines.Add('>>>'+#9+eType+ss+eMessage);
finally
end;
end;

Copyright 2005 by SCardSOFT


26 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your fi rst application. " Hello, cards World ! "

It's easy! Call this function on the each occured event and you will see all received events by
looking thru the text lines into the Memo control:

procedure TMainForm.SCardX_Easy ReaderStateChanged (ASender: TObject;


var ReaderName: WideString;
var ReaderState: Integer;
var ReaderStateHex, ReaderStateLookup : WideString );
begin
AddEvent ('OnReaderStateChanged',ReaderName+' : 0x'+ReaderStateHex);
end;

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your first appli cation. " Hell o, cards World ! " 27

4.5 Preparing the connection controls

Before working with smart cards we need to connect the smart card service.

Place on the form the three buttons for the connection commands and one combo box for the
readers names list like on this picture:

Service connecting commands

By clicking on the "Connect " command button we'll select the MS Smart Card service and set up
the connection state of SCardX Easy as connected:

procedure TMainForm.Button2Click(Sender: TObject);


begin
try
// selecting the MS Smart Card service (PC/SC)
SCardX_Easy. SmartCardService :=srv_MS_PCSC_SCard_Service ;
// connecting the service
SCardX_Easy. ConnectionState:=stServiceConnected;
finally
end;
end;

By clicking on the "Disconnect" command button we'll close the connection and unload the driver:

procedure TMainForm.Button4Click(Sender: TObject);


begin
try
// closing the connection
SCardX_Easy. ConnectionState:=stServiceNotConnected ;
// unloading the driver
SCardX_Easy. SmartCardService :=srv_Not_Defined;
finally
end;
end;

What will be happened after clicking on the "Connect" button :

the SCardX Easy loads the driver libraries and makes the connection to the selected smart
card service;
OnConnected events occurs; on this event you can enable the controls on the form by calling
the EnableControls function;
the SCardX Easy loads from the service the list of the names of the available card readers
which are attached to your PC;
OnReadersList events occurs; on this event you can receive and store the readers list;
the SCardX Easy starts to listen the devices for the changes of its states;

Copyright 2005 by SCardSOFT


28 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your fi rst application. " Hello, cards World ! "

from now the application will receive the following readers states events:
OnReaderStateChanged
OnCardWait : on this event you can enable the controls on the form by calling the
EnableCardControls function;
OnCardDetected
OnCardInvalid
OnCardReady : on this event you can enable the controls on the form by calling the
EnableCardControls function;
OnReaderSelected : on this event you can enable the controls on the form by calling the
EnableCardControls function;

Readers list receiving


All smart card or device commands of the SCardX Easy ActiveX control needs the reader name as
a parameter.

You can receive and store on the form the readers list by the two ways:
using the OnReadersList event;
using the GetReadersList function of the SCardX Easy;

The demo application uses the ReadersList combo box as a readers names' container. And
additionally the selected reader of this combo box always used as the active reader name for all
smart cards' and devices' commands.

For filling up of the ReadersList combo box by the real names of attached readers the demo
application has a function MakeReadersList:

procedure TMainForm.MakeReadersList(RList: string);


begin
try
ReadersList.Clear;
if RList>''
then begin
ReadersList.Items.Text:=RList;
ReadersList.Sorted:=true;
ReadersList.ItemIndex:=0;
end;
finally
EnableCardControls;
end;
end;

The demo application calls the MakeReadersList automatically on the OnReadersList event:

procedure TMainForm.SCardX_Easy ReadersList(ASender: TObject; var ReadersList:


WideString);
begin
try
MakeReadersList(ReadersList);
finally
end;
end;

It's easy! The SCardX Easy ActiveX control gives you the readers list as a parameter of the
OnReadersList event!

Alternatively you can receive the readers list at any time using the GetReadersList function of the
SCardX Easy. For this command the demo application has the "Refresh Readers List" button.

By clicking on the "Refresh Readers List" command button the application reloads the readers list:

procedure TMainForm.Button3Click(Sender: TObject);


begin
try
MakeReadersList(SCardX_Easy. GetReadersList);

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your first appli cation. " Hell o, cards World ! " 29

finally
end;
end;

4.6 Preparing the opened reader controls

After receiving of the OnCardReady event the application may call the following functions of the
SCardX Easy ActiveX control:

ReopenReader
GetReaderInfoFmt
GetReaderInfo
GetCardInfoFmt
GetCardInfo
GetCardATR
SendCardAPDU
SendCardDATA

All these functions takes the opened reader name as a parameter and may be called after
receiving the OnCardReady event only.

Reopen Reader command


Add the "Reopen Reader" button on the form.

By clicking on this button the application will reopens the selected card reader:

procedure TMainForm.Button5Click(Sender: TObject);


var ss:widestring;
begin
try
ss:=ReadersList.Text;
SCardX_Easy. ReopenReader (ss);
finally
end;
end;

Copyright 2005 by SCardSOFT


30 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your fi rst application. " Hello, cards World ! "

Receiving the Reader Info


Add the "Get Reader Info" button and the "Format Info" checkbox on the form.

The SCardX Easy has two functions for the reader info receiving:
GetReaderInfo
GetReaderInfoFmt

The function GetReaderInfo returns the not formatted info lines like these ones:
[VENDOR INFO]
VENDOR NAME=SCM Microsystems Inc.
VENDOR IFD TYPE=CHIPDRIVE Serial
VENDOR IFD VERSION=< no info >
VENDOR IFD SERIAL NO=12639860

The function GetReaderInfoFmt returns the formatted info lines like these ones:

VENDOR INFO
VENDOR NAME .................. SCM Microsystems Inc.
VENDOR IFD TYPE .............. CHIPDRIVE Serial
VENDOR IFD VERSION ........... < no info >
VENDOR IFD SERIAL NO ......... 12639860

By clicking on the "Get Reader Info" button the application will receive the info lines :

procedure TMainForm.Button6Click(Sender: TObject);


var ss:widestring;
s:string;
begin
try

ss:=ReadersList.Text;
if CheckBox8.Checked
then s:=SCardX_Easy. GetReaderInfoFmt (ss)
else s:=SCardX_Easy. GetReaderInfo(ss);

AddEvent ('GetReaderInfo',ReadersList.Text);
Memo.Lines.Add(s);

finally
end;
end;

Receiving the Card Info


Add the "Get Card Info" and "Get Card ATR" button and the "Format Info" checkbox on the form.

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your first appli cation. " Hell o, cards World ! " 31

The SCardX Easy has two functions for the card info receiving:
GetCardInfo
GetCardInfoFmt

The function GetCardInfo returns the not formatted info lines like these ones:
[ICC STATE]
ATR STRING=3B 79 94 00 00 59 01 01 0F 01 00 01 04 A9
ICC PRESENCE=2
ICC INTERFACE STATUS=255
ICC TYPE PER ATR=1
CURRENT IO STATE=< no info >
[PROTOCOL]
DEFAULT DATA RATE=9624
MAX DATA RATE=115484
ASYNC PROTOCOL TYPES=3
DEFAULT CLK=3580

The function GetCardInfoFmt returns the formatted info lines like these ones:
ICC STATE
ATR STRING ................... 3B 79 94 00 00 59 01 01 0F 01 00 01 04 A9
ICC PRESENCE ................. 2
ICC INTERFACE STATUS ......... 255
ICC TYPE PER ATR ............. 1
CURRENT IO STATE ............. < no info >

PROTOCOL
DEFAULT DATA RATE ............ 9624
MAX DATA RATE ................ 115484
ASYNC PROTOCOL TYPES ......... 3
DEFAULT CLK .................. 3580

By clicking on the "Get Card Info" button the application will receive the info lines :

procedure TMainForm.Button7Click(Sender: TObject);


var ss:widestring;
s:string;
begin
try

ss:=ReadersList.Text;
if CheckBox9.Checked
then s:=SCardX_Easy. GetCardInfoFmt(ss)
else s:=SCardX_Easy. GetCardInfo(ss);

AddEvent ('GetCardInfo',ReadersList.Text);
Memo.Lines.Add(s);

finally
end;
end;

Copyright 2005 by SCardSOFT


32 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your fi rst application. " Hello, cards World ! "

By clicking on the "Get Card ATR" button the application will receive the ATR string of the opened
card:

procedure TMainForm.Button8Click(Sender: TObject);


var ss:widestring;
s:string;
begin
try
ss:=ReadersList.Text;
s:=SCardX_Easy.GetCardATR (ss);

AddEvent ('GetCardATR',ReadersList.Text);
Memo.Lines.Add(s);

finally
end;
end;

Command APDU sending


Add on the form the following controls:

By clicking on the "Send APDU" button the application gets the hexadecimal parts of a command
APDU according to ISO-7816 from the form's edit controls and puts its to parameters of the
SCardX Easy's function SendCardAPDU :

procedure TMainForm.Button9Click(Sender: TObject);


var wReaderName,wCla,wIns,wP1,wP2,wP3,wLe,wDataIn,wSW,wDataOut:widestring;
ss:string;
begin
try
SW.Text:='';
DataOut.Text:='';
ss:='';

try
wReaderName := ReadersList.Text;
wCla := Cla.Text;
wIns := Ins.Text;
wP1 := P1.Text;
wP2 := P2.Text;
wP3 := P3.Text;
wLe := Le.Text;
wDataIn := DataIn.Text;
wSW := '';
wDataOut := '';

ss:=SCardX_Easy. SendCardAPDU (wReaderName,wCla,wIns,wP1,wP2,wP3,wLe,wDataIn,wSW,wDataOu


t);

except on em:exception do
begin // ### ERROR HERE
ss:='';
ShowMessage(em.Message);
end;
end;

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your first appli cation. " Hell o, cards World ! " 33

finally
if (ss>'')
then begin
SW.Text:=wSW;
DataOut.Text:=wDataOut;
end;
end;
end;

This function returns the card's response APDU data as parameters according to ISO-7816 :
the status word SW1SW2 value in the hexadecimal format; it placed in the edit control labeled
"Received SW1SW2 (Hex)";
the DataOut buffer in the hexadecimal format; it placed in the edit control labeled "Received
DataOut (Hex)"

Unformatted data buffers sending


Add on the form the following controls:

By clicking on the "Send DATA" button the application gets the hexadecimal value of the send
buffer labeled as "Data for send (Hex)" and puts its to a parameter of the SCardX Easy's function
SendCardDATA :

procedure TMainForm.Button10Click(Sender: TObject);


var wReaderName,wDataReceived,wDataSend:widestring;
begin
try
DataReceived.Text:='';

try
wReaderName := ReadersList.Text;
wDataSend := DataSend.Text;

wDataReceived := SCardX_Easy. SendCardDATA (wReaderName,wDataSend);

except on em:exception do
begin // ### ERROR HERE
wDataReceived:='';
ShowMessage(em.Message);
end;
end;

finally
if (wDataReceived>'')
then begin
DataReceived.Text:=wDataReceived;
end;
end;
end;

This function returns the card's answer on the sent data in the hexadecimal format. The returned

Copyright 2005 by SCardSOFT


34 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your fi rst application. " Hello, cards World ! "

data placed in the edit control labeled "Received Data (Hex)".

4.7 Tray Icon

The SCardX Easy ActiveX control allows you to manage the tray icon pop-up menu items and to
receive the tray icon events.

Preparing the form controls


Add on the form the following controls:

Creating your own tray icon menu


The new pop-up menu of the SCardX Easy tray icon creates easy by calling of the
TrayIconMenuCreate function.

You need to prepare the menu items list according to these rules:

each new line in the list is the new menu item template;
each menu item template consists of two parts;
the menu item ID;
the menu item caption;
the parts of the menu item template are divided by the "=" character;
if the menu item template begins with a "-" character the menus divider will be created;

Use the memo on the form for preparing of the menu items list before menu creating.

For example your menu items list may be prepared like this:

ID_1=My Menu Item 1


- it's the divider
ID_2=My Menu Item 2
ID_3=My Menu Item 3

By clicking on the "Recreate TryIcon Menu" button the SCardX Easy will recreate its tray icon pop-
up menu:

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your first appli cation. " Hell o, cards World ! " 35

procedure TMainForm.Button14Click(Sender: TObject);


var ww:widestring;
begin
try
ww:=MenuItemsList.Lines.Text;
SCardX_Easy. TrayIconMenuCreate (ww);
finally
end;
end;

Changing the menu item properties


You can set up the following menu item properties:

checked / unchecked
enabled / disabled
default / standart

All functions for changing of the menu item's properties takes the item ID string as a parameter.

Setting up the menu item as checked / unchecked


By clicking on the "Checked" button the SCardX Easy makes the menu item as checked:

procedure TMainForm.Button18Click(Sender: TObject);


var ww:widestring;
bb:wordbool;
begin
try
ww:=Edit3.Text; // ItemID
bb:=true;
SCardX_Easy. TrayIconMenuItemSetChecked (ww,bb);
finally
end;
end;

Copyright 2005 by SCardSOFT


36 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your fi rst application. " Hello, cards World ! "

By clicking on the "Unchecked" button the SCardX Easy makes the menu item as unchecked:

procedure TMainForm.Button16Click(Sender: TObject);


var ww:widestring;
bb:wordbool;
begin
try
ww:=Edit3.Text; // ItemID
bb:=false;
SCardX_Easy. TrayIconMenuItemSetChecked (ww,bb);
finally
end;
end;

Setting up the menu item as enabled / disabled


By clicking on the "Disabled" button the SCardX Easy makes the menu item as disabled:

procedure TMainForm.Button15Click(Sender: TObject);


var ww:widestring;
bb:wordbool;
begin
try
ww:=Edit3.Text; // ItemID
bb:=false;
SCardX_Easy. TrayIconMenuItemSetEnabled (ww,bb);
finally
end;
end;

By clicking on the "Enabled" button the SCardX Easy makes the menu item as enabled:

procedure TMainForm.Button19Click(Sender: TObject);


var ww:widestring;
bb:wordbool;
begin
try
ww:=Edit3.Text; // ItemID
bb:=true;
SCardX_Easy. TrayIconMenuItemSetEnabled (ww,bb);
finally
end;
end;

Setting up the menu item as default / standart


By clicking on the "Default" button the SCardX Easy makes the menu item as default:

procedure TMainForm.Button20Click(Sender: TObject);


var ww:widestring;
bb:wordbool;
begin

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your first appli cation. " Hell o, cards World ! " 37

try
ww:=Edit3.Text; // ItemID
bb:=true;
SCardX_Easy. TrayIconMenuItemSetDefault (ww,bb);
finally
end;
end;

By clicking on the "Standart" button the SCardX Easy makes the menu item as standart menu
item:

procedure TMainForm.Button17Click(Sender: TObject);


var ww:widestring;
bb:wordbool;
begin
try
ww:=Edit3.Text; // ItemID
bb:=false;
SCardX_Easy. TrayIconMenuItemSetDefault (ww,bb);
finally
end;
end;

Receiving the tray icon menu events


The SCardX Easy creates the OnTrayIconMenuItem event when user clicks on the menu item:

procedure TMainForm.SCardX_Easy TrayIconMenuItem(ASender: TObject;


var ItemID: WideString;
var IsChecked, IsEnabled, IsDefault: WordBool;
var Caption: WideString );
begin
AddEvent ('OnTrayIconMenuItem',Caption);
end;

Receiving the tray icon mouse double click event


The SCardX Easy creates the OnTrayIconDblClick event when user double clicks on the tray icon:

procedure TMainForm.SCardX_EasyTrayIconDblClick(Sender: TObject);


begin
AddEvent ('TrayIconDblClick','');
end;

Copyright 2005 by SCardSOFT


38 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your fi rst application. " Hello, cards World ! "

4.8 LookUp service

The SCardX Easy allows you to decode the system error codes and the reader states codes from
its numerical values to its string descriptions.

Add on the form the following controls:

Error LookUp
By clicking on the "Error LookUp" button the application calls the lookup function and receives the
decoded value:

procedure TMainForm.Button12Click(Sender: TObject);


var ww:widestring;
ss:string;
begin
try
ww:=Edit1.Text;

ss:=SCardX_Easy. LookUpError(ww);

AddEvent ('LookUpError','');
Memo.Lines.Add('0x'+Edit1.Text+' : '+ss);
finally
end;
end;

Reader State LookUp


By clicking on the "State LookUp" button the application calls the lookup function and receives the
decoded value:

procedure TMainForm.Button13Click(Sender: TObject);


var ww:widestring;
ss:string;
begin
try
ww:=Edit2.Text;

ss:=SCardX_Easy. LookUpReaderState (ww);

AddEvent ('LookUpReaderState','0x'+Edit2.Text);
Memo.Lines.Add(ss);
finally
end;
end;

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your first appli cation. " Hell o, cards World ! " 39

4.9 Data ciphering

The SCardX Easy ActiveX control allows you to encrypt and to decrypt the text strings using the
DES algorithm.

Add on the form the following controls:

Before using the ciphering functions you need to prepare the Key value in the hexadecimal format.

Key rules:

if you want to use ASCII symbols like the letters or numbers as a key you need to convert its
char codes to a hexadecimal format;

for example the ASCII text "MyKey123 " in the hex format is "4D794B6579313233 "

the length of the binary key always must be 8 bytes and the length of the key in the
hexadecimal format always must be 16 hex symbols!

Create the new key and place its hex value into the edit control labeled "Key (Hex)".

DES data encoding


Type any text you like into the text control labeled "Text for encrypt".

By clicking on the "Encrypt" button the application takes the key hex value and the text for encrypt
from the form's edit controls and calls the DES_EncryptString encrypt function:

procedure TMainForm.Button21Click(Sender: TObject);


var kk,ww:widestring;
ss:string;
begin
try
kk:=Trim(KeyDES.Text); // Key
ww:=Trim(EncText.Text); // Text

ss:=SCardX_Easy. DES_ EncryptString (kk,ww);

AddEvent ('DES Encrypt String','');


Memo.Lines.Add ('DES Key : '+kk);

Copyright 2005 by SCardSOFT


40 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your fi rst application. " Hello, cards World ! "

Memo.Lines.Add ('Text for encrypt : '+ww);


Memo.Lines.Add ('Encrypted data : '+ss);

finally
end;
end;

Encrypting example:

DES Key : AE9601A32FBCA85F


Text : Demo text for encrypt
Encrypted data : D6 D1 DB 24 59 8B 3A 9F 4D 22 58 96 68 92 AB 29 40 41 16 B4 69 64 15
28

DES data decoding


Type the previous encrypted text as a hex buffer into the text control labeled "Encrypted data
(Hex)".

By clicking on the "Decrypt" button the application takes the key hex value and the encrypted hex
buffer from the form's edit controls and calls the DES_DecryptString decrypt function:

procedure TMainForm.Button22Click(Sender: TObject);


var kk,ww:widestring;
ss:string;
begin
try
kk:=Trim(KeyDES.Text); // Key
ww:=Trim(DecText.Lines.Text); // Encrypted hex buffer

ss:=SCardX_Easy. DES_DecryptString (kk,ww);

AddEvent ('DES Decrypt String','');


Memo.Lines.Add ('DES Key : '+kk);
Memo.Lines.Add ('Encrypted data : '+ww);
Memo.Lines.Add ('Decrypted data : '+ss);
finally
end;
end;

Decrypting example:

DES Key : 8CA64DE9C1B123A7


Encrypted data : BA 40 AC 43 81 34 9A DC AF 60 0B D5 EC 49 86 F8 90 7B B0 71 C1 05 38
A9
Decrypted text : Decrypt demo text

4.10 Card detecting defaults

The SCardX Easy allows you to set up the card detecting defaults.

Add on the form the following controls:

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your first appli cation. " Hell o, cards World ! " 41

Fill up the combo box labeled "Preferred Protocol" by the following string list:

Autodetect
T0
T1
RAW
Undefined

Fill up the combo box labeled "Preferred Sharing Mode" by the following string list:

Share Reader
Exclusive Use
Direct Reader Control

Fill up the combo box labeled "Card Closing Mode" by the following string list:

Leave Card
Reset Card
Unpower Card
Eject Card

By clicking on the "Set Card Detecting Defaults" button the application sets up the preferences
values using the SetPref_PCSC_OnCardDetect function:

procedure TMainForm.Button23Click(Sender: TObject);


var AutoOpen : WordBool;
PreferredProtocol: TxProtocol;
PreferredSharingMode: TxSharingMode;
CardClosingMode: TxCardClosingMode;
begin
try

AutoOpen:=CheckBox12.Checked;
PreferredProtocol:= TxProtocol(ComboBox1.ItemIndex);
PreferredSharingMode:= TxSharingMode(ComboBox2.ItemIndex);
CardClosingMode:= TxCardClosingMode(ComboBox3.ItemIndex);

SCardX_Easy. SetPref_PCSC_OnCardDetect (AutoOpen,PreferredProtocol,PreferredSharingMode,Ca


rdClosingMode);

finally
end;
end;

All preferences changes becomes visible on the "States" page of the SCardX Easy immediately:

Copyright 2005 by SCardSOFT


42 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your fi rst application. " Hello, cards World ! "

4.11 Configuring the application startup

The application startup is a good moment for setting up the SCardX Easy's properties.

// setting up the user interface properties


SCardX_Easy. BorderStyle:=afbSingle;
SCardX_Easy. VisibleToolBar:=false;
SCardX_Easy. VisibleStatusBar :=true;
SCardX_Easy. EventsHistoryEnabled :=true;
SCardX_Easy. VisibleEventsHistory :=true;
SCardX_Easy. ActivePage:=apStates;

// connecting the service


SCardX_Easy. SmartCardService :=srv_MS_PCSC_SCard_Service;
SCardX_Easy. ConnectionState:=stServiceConnected;

We recommend you to set up the user interface properties of the SCardX Easy like the
BorderStyle and other on the application startup.

Additonally you may call the interface function:

// enabling/disabling the controls


EnableControls;

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your first appli cation. " Hell o, cards World ! " 43

4.12 Configuring the application shutdown

Important! Be careful!

You must call the finalization function of the SCardX Easy on the application's shutdown!

procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);


begin
SCardX_Easy. Finalize ;
end;

4.13 Tell : - " Hello, cards World ! "

Ok. Your first application is already prepared and ready to start!

ISO-7816 standard and smart card basics


The ISO-7816 is a base of the smart cards functionality. All another smart cards specifications was
created under this standard and expands it only.

The card command may be sent into a card as a data buffer which is formatted as a command
APDU (Application P rotocol Data Unit ).

The card's answer on each command APDU is the data buffer which is formatted as a response
APDU .

According to ISO-7816-4 5.3.1 the command APDU consists of :


a mandatory header of 4 bytes : Cla Ins P1 P2 ;
a conditional body of a variable length;

Command APDU structure:

Header Body
Cla Ins P1 P2 [Lc field] [DataIn field] [Le field]

What is the command APDU content?

According to ISO-7816-4 5.4 the command APDU contents :

Copyright 2005 by SCardSOFT


44 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your fi rst application. " Hello, cards World ! "

Code Name Length Description

Cla Class 1 Class of instruction


Ins Instruction 1 Instruction code
P1 Parameter1 1 Instruction parameter 1
P2 Parameter 2 1 Instruction parameter 2

P3/Lc Length variable Number of bytes present in


field 1 or 3 the data field of the command

DataIn Data variable String of bytes sent in the data


field = Lc field of the command

Le Length variable Maximum number of bytes


field <= 3 inspected in the data field of
the response to the command

So each command is an APDU-formatted array of bytes which may be sent into a card.

What happens after the data was sent?

The card answers on the sent command APDU by its response APDU .

According to ISO-7816-4 5.3.3 the response APDU consists of :


a conditional body of a variable length;
a mandatory trailer of 4 bytes (status word) : SW1 SW2 ;

Body Trailer
[DataOut field ] SW1 SW2

What is the response APDU content?

According to ISO-7816-4 5.4 the response APDU contents :

Code Name Length Description

DataOut Data variable String of bytes received in the


field = Le data field of the response

SW1 Status byte 1 1 Command processing status


SW2 Status byte 2 1 Command processing
qualifier

How it works?

For preparing of the command you need only to fill up the command APDU fields according to the
card command which you need send into the card. Where can you find the values of these fields?
You may find all necessary info about the command APDU and response APDU fields' values in
the specifications of your smart cards.

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your first appli cation. " Hell o, cards World ! " 45

The ISO-7816 standard defines the global principles of the card's functionality only.

The real cards always differs by its available commands' set and by the values of the command
APDU fields and all cards differs by its response APDU fields values.

But all chip smart cards always receives the commands as command APDU 's and answers back
by the response APDU 's according to ISO-7816.

Please look more about the smart cards basics into the ISO-7816 standard and into the your cards'
specifications.

Your first smart card command


As example we'll use the GSM SIM card and the GSM11.11 card specification.

According to ISO-7816 any chip smart card must have the Master File (MF) named 3F00. It's the
"root directory" of the smart card's filesystem. The SIM card has the "3F00" file too.

We'll try to send to the SIM card the command SELECT MF.

According to GSM11.11 9.2.1 the command APDU for the command SELECT is defined as:

And according to GSM11.11 9.4.1 the successful respond APDU is defined as:

Copyright 2005 by SCardSOFT


46 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Your fi rst application. " Hello, cards World ! "

So, according to GSM11.11 our command APDU is:

Cla = A0
Ins = A4
P1 = 00
P2 = 00
P3/Lc = 02
DataIn = 3F00

And after of this command APDU will be sent into the card you may receive from the card the
following response APDU :

DataOut = <none>
SW1 SW2 = 9F XX ( where XX is the length of the response data)

You can test this command using your new smart card application:

1. run the application;


2. connect to the service;
3. insert the card into a reader;
4. after the card will be opened by SCardX Easy please select your reader in the readers list
on the form;
5. fill up the fields of the "APDU Sending " controls on the form according to the command
APDU which was defined before;
6. click on the "Send APDU " button;
7. after the command sending please look on the edit control labeled as "Received SW1 SW2
(Hex) " - there is the status word hex value like "9F17" must present there;

That's all.

You have prepared your first command APDU, you have sent this command into the card and you
have received from the card its answer on your command.

Congratulations!
At this moment you already have told to your SIM card - " Hello, cards World ! ".

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 47

5 SCardX Easy interface specification

5.1 Properties

User interface properties

ActivePage
BorderStyle
BorderWidth
EventsHistoryEnabled
EventsLogging
Visible
VisibleEventsHistory
VisibleStatusBar
VisibleToolBar
VisibleTrayIcon

Smart card work properties

ConnectionState
SmartCardService
SeparateReceivedBytes

5.1.1 ActivePage

Specifies what the page of SCardX Easy is on the front of the control .

apStates apEventsHistory

Copyright 2005 by SCardSOFT


48 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

Description

Use the ActivePage property to determine what page is on the front of the control.

Type:

C++ : int
Basic : As Long
Delphi : Integer

Possible values:
apStates = $00000000
apEventsHistory = $00000001

Delphi syntax:

type TxActivePage = TOleEnum;

property ActivePage: TxActivePage;

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 49

5.1.2 BorderStyle

Specifies the drawing style of the border of the SCardX Easy control.

afbNone afbSingle afbSunken afbRaised

Description

Use the BorderStyle property for setting up the control's border style.

Type:

C++ : int
Basic : As Long
Delphi : Integer

Possible values:
afbNone = $00000000
afbSingle = $00000001
afbSunken = $00000002
afbRaised = $00000003

Delphi syntax:
type TxActiveFormBorderStyle = TOleEnum;

property BorderStyle: TxActiveFormBorderStyle;

5.1.3 BorderWidth

Specifies the control's inner border width.

Copyright 2005 by SCardSOFT


50 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

BorderWidth = 0 BorderWidth = 5 BorderWidth = 10

Description

Use the BorderWidth property for setting up the control's inner border width.

Type:

C++ : int
Basic : As Long
Delphi : Integer

Delphi syntax:

property BorderWidth: Integer;

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 51

5.1.4 ConnectionState

Specifies the current state of the connection to the selected smart card service.

Description

Use the ConnectionState property for connecting or disconnecting of the selected smart card
service.

This property is unavailable while the SmartCardService is equal srv_Not_Defined.

Type:

C++ : int
Basic : As Long
Delphi : Integer

Possible values:
stServiceNotConnected = $00000000
stServiceConnected = $00000001

Delphi syntax:
type TxConnectionState = TOleEnum;

property ConnectionState: TxConnectionState;

5.1.5 EventsHistoryEnabled

Specifies whether the events history logging is enabled.

Description

Use the EventsHistoryEnabled property for enabling or disabling the logging of events on the
Events History page.

Type:

C++ : bool
Basic : As Boolean
Delphi : WordBool

Delphi syntax:
property EventsHistoryEnabled: WordBool;

Copyright 2005 by SCardSOFT


52 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

5.1.6 EventsLogging

Specifies the events logging mode.

Description

Use the EventsLogging property to determine the control's events logging mode.

Set the EventsLogging to xLog_AllEvents if you need more detailed events log.

Type:

C++ : int
Basic : As Long
Delphi : Integer

Possible values:
xLog_AllEvents = $00000000
xLog_MostUsefulEvents = $00000001

Delphi syntax:
type TxEventsLoggingMode = TOleEnum;

property EventsLogging: TxEventsLoggingMode;

5.1.7 SeparateReceivedBytes

Specifies whether the received from the card hex bytes will be separated by the space character.

Description

Set the SeparateReceivedBytes property to true if you want to receive the separated bytes like
this:
3B 79 94 00 59 01 01 0F 01

Otherwise the data will be received and showed like this:


3B799400005901010F01

Type:

C++ : bool
Basic : As Boolean
Delphi : WordBool

Delphi syntax:
property SeparateReceivedBytes: WordBool;

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 53

5.1.8 SmartCardService

Specifies the selected smart card service.

Description

Use this property to change the selected smart card service.

If the srv_Not_Defined value assigned in this case the SCardX Easy closes all active connections
and unloads the previous loaded service's drivers.

If the srv_MS_PCSC_SCard_Service value assigned in this case the SCardX Easy tries to find the
MS Smart Card service's libraries and loads its.

After the service will be loaded you can connect of this service by assigning the value
stServiceConnected to the ConnectionState property.

Type:

C++ : int
Basic : As Long
Delphi : Integer

Possible values:
srv_Not_Defined = $00000000
srv_MS_PCSC_SCard_Service = $00000001

Delphi syntax:
type TxSCardService = TOleEnum;

property SmartCardService: TxSCardService;

5.1.9 Visible

Specifies the SCardX Easy control's visibility.

Description

Set the Visible property to false if you wish to hide the control on your application.

Type:

C++ : bool
Basic : As Boolean
Delphi : WordBool

Delphi syntax:
property Visible: WordBool;

Copyright 2005 by SCardSOFT


54 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

5.1.10 VisibleEventsHistory

Specifies the visibility of the "Events History" panel.

True False

Description

Use the VisibleEventsHistory property for showing or hiding the "Events History" panel of the
control.

Type:

C++ : bool
Basic : As Boolean
Delphi : WordBool

Delphi syntax:
property VisibleEventsHistory: WordBool;

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 55

5.1.11 VisibleStatusBar

Specifies the visibility of the status bar of the SCardX Easy.

True False

Description

Use the VisibleStatusBar property for showing or hiding the status bar of the control.

Type:

C++ : bool
Basic : As Boolean
Delphi : WordBool

Delphi syntax:
property VisibleStatusBar: WordBool;

5.1.12 VisibleToolBar

Specifies the visibility of the tool bar of the SCardX Easy.

True False

Description

Use the VisibleToolBar property for showing or hiding the tool bar of the control.

Copyright 2005 by SCardSOFT


56 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

Type:

C++ : bool
Basic : As Boolean
Delphi : WordBool

Delphi syntax:
property VisibleToolBar: WordBool;

5.1.13 VisibleTrayIcon

Specifies the visibility of the tray icon of the SCardX Easy.

True

Description

Use the VisibleTrayIcon property for showing or hiding the tray icon of the control.

Warning! You can hide the TrayIcon under the Site or Developer's License only !

Type:

C++ : bool
Basic : As Boolean
Delphi : WordBool

Delphi syntax:
property VisibleTrayIcon: WordBool;

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 57

5.2 Functions

User interface functions

EventsHistoryClear
GetEventsHistory
SetPref_PCSC_OnCardDetect
TrayIconMenuClear
TrayIconMenuCreate
TrayIconMenuItemSetChecked
TrayIconMenuItemSetDefault
TrayIconMenuItemSetEnabled

Smart card work functions

GetCardATR
GetCardInfo
GetCardInfoFmt
GetReaderInfo
GetReaderInfoFmt
GetReadersList
IsCardReady
ReopenReader
SendCardAPDU
SendCardDATA

Other functions

DES_DecryptString
DES_EncryptString
Finalize
IsLocked
LookUpError
LookUpReaderState
Version
VersionMajor
VersionMinor

Copyright 2005 by SCardSOFT


58 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

5.2.1 DES_DecryptString

Decrypts the encrypted by DES algorithm hexadecimal data buffer.

Arguments / parameters

Argument Name Data Type Description

KeyHEX C++ : BSTR the hex data buffer of the DES key value;
Basic : As String
( input ) Delphi : WideString the length of the binary key always must 8 bytes and
the length of the key in the hexadecimal format always
must 16 hex symbols;

do not use ASCII symbols for the key value : always


use the hexadecimal format only;

EncryptedDataHEX C++ : BSTR the hex data buffer of the previously encrypted by DES
Basic : As String text string;
( input ) Delphi : WideString

All arguments are passed by reference.

Returns

The function returns the decrypted text string.

Returning value data type

C++ : BSTR
Basic : As String
Delphi : WideString

Delphi syntax:
function DES_DecryptString(var KeyHEX: WideString; var EncryptedDataHEX: WideString):
WideString;

5.2.2 DES_EncryptString

Encrypts the ASCII symbols text string by the DES algorithm.

Arguments / parameters

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 59

Argument Name Data Type Description

KeyHEX C++ : BSTR the hex data buffer of the DES key value;
Basic : As String
( input ) Delphi : WideString the length of the binary key always must 8 bytes and
the length of the key in the hexadecimal format always
must 16 hex symbols;

do not use ASCII symbols for the key value : always


use the hexadecimal format only;

CryptString C++ : BSTR any text string for encrypt;


Basic : As String
( input ) Delphi : WideString

All arguments are passed by reference.

Returns

The function returns the hex data buffer of the encrypted string.

Returning value data type

C++ : BSTR
Basic : As String
Delphi : WideString

Delphi syntax:
function DES_EncryptString(var KeyHEX: WideString; var CryptString: WideString):
WideString;

5.2.3 EventsHistoryClear

Deletes all events messages from the grid of the "Events History" page of the control.

Arguments / parameters
<none>

Returns
<none>

Delphi syntax:
procedure EventsHistoryClear;

Copyright 2005 by SCardSOFT


60 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

5.2.4 Finalize

Closes all opened connections and frees all used memory.

Arguments / parameters
<none>

Returns
<none>

Description

Always call this function on the application shutdown!

After calling of this function the SCardX Easy becomes unusable and ready for closing.

Delphi syntax:
procedure Finalize;

5.2.5 GetCardATR

Returns the ATR string of the opened smart card.

Arguments / parameters

Argument Name Data Type Description

ReaderName C++ : BSTR smart card reader name;


Basic : As String
( input ) Delphi : WideString

All arguments are passed by reference.

Returns

The function returns the ATR string in a hexadecimal format.

Returning value data type

C++ : BSTR
Basic : As String
Delphi : WideString

Delphi syntax:
function GetCardATR(var ReaderName: WideString): WideString;

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 61

5.2.6 GetCardInfo

Returns the information about the opened smart card.

Arguments / parameters

Argument Name Data Type Description

ReaderName C++ : BSTR smart card reader name;


Basic : As String
( input ) Delphi : WideString

All arguments are passed by reference.

Returns

The function returns the info string list.

Returning value data type

C++ : BSTR
Basic : As String
Delphi : WideString

Description

This function returns the list of the strings which are divided by the line breaks symbols #13#10.

Each info line is formatted as a standart INI file like of this example:
[ICC STATE]
ATR STRING=3B 79 94 00 00 59 01 01 0F 01 00
ICC PRESENCE=2
ICC INTERFACE STATUS=255
ICC TYPE PER ATR=1

Delphi syntax:

function GetCardInfo(var ReaderName: WideString): WideString;

5.2.7 GetCardInfoFmt

Returns the formatted information about the opened smart card.

Arguments / parameters

Copyright 2005 by SCardSOFT


62 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

Argument Name Data Type Description

ReaderName C++ : BSTR smart card reader name;


Basic : As String
( input ) Delphi : WideString

All arguments are passed by reference.

Returns

The function returns the info string list.

Returning value data type

C++ : BSTR
Basic : As String
Delphi : WideString

Description

This function returns the list of the strings which are divided by the line breaks symbols #13#10.

Each info line is formatted and already prepared for displaying like of this example:
ICC STATE
ATR STRING ................... 3B 79 94 00 00 59 01 01 0F 01 00 01 04 A9
ICC PRESENCE ................. 2
ICC INTERFACE STATUS ......... 255
ICC TYPE PER ATR ............. 1
CURRENT IO STATE ............. < no info >

Delphi syntax:
function GetCardInfoFmt(var ReaderName: WideString): WideString;

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 63

5.2.8 GetEventsHistory

Returns the events history strings list from the "Events History" page.

Arguments / parameters
<none>

Returns

The function returns the events history string list.

Returning value data type

C++ : BSTR
Basic : As String
Delphi : WideString

Description

This function returns the list of the events messages from the "Events History" page which are
divided by the line breaks symbols #13#10 :

N Source Event Value Event Time


1 MS Smart Card service Driver loaded 00:02:18 01-XXX-05
2 MS Smart Card service Service connected 00:02:18 01-XXX-05
3 AKS ifdh 0 Reader state changed 0x00000012 : There is not card in the
reader 00:02:18 01-XXX-05
4 AKS ifdh 1 Reader state changed 0x00000012 : There is not card in the
reader 00:02:18 01-XXX-05
5 SCM Microsystems Inc. CHIPDRIVE Serial 0 Reader state changed 0x001E0012 :
There is not card in the reader 00:02:18 01-XXX-05

All fields in the each string are divided by the Tab character #9 .

This function may be useful for the errors localization during debugging of the remote application.

Delphi syntax:
function GetEventsHistory: WideString;

Copyright 2005 by SCardSOFT


64 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

5.2.9 GetReaderInfo

Returns the information about the reader.

Arguments / parameters

Argument Name Data Type Description

ReaderName C++ : BSTR smart card reader name;


Basic : As String
( input ) Delphi : WideString

All arguments are passed by reference.

Returns

The function returns the info string list.

Returning value data type

C++ : BSTR
Basic : As String
Delphi : WideString

Description

This function returns the list of the strings which are divided by the line breaks symbols #13#10.

Each info line is formatted as a standart INI file like of this example:
[VENDOR INFO]
VENDOR NAME=SCM Microsystems Inc.
VENDOR IFD TYPE=CHIPDRIVE Serial
VENDOR IFD VERSION=< no info >
VENDOR IFD SERIAL NO=12639860

Delphi syntax:

function GetReaderInfo(var ReaderName: WideString): WideString;

5.2.10 GetReaderInfoFmt

Returns the formatted information about the reader.

Arguments / parameters

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 65

Argument Name Data Type Description

ReaderName C++ : BSTR smart card reader name;


Basic : As String
( input ) Delphi : WideString

All arguments are passed by reference.

Returns

The function returns the info string list.

Returning value data type

C++ : BSTR
Basic : As String
Delphi : WideString

Description

This function returns the list of the strings which are divided by the line breaks symbols #13#10.

Each info line is formatted and already prepared for displaying like of this example:
VENDOR INFO
VENDOR NAME .................. SCM Microsystems Inc.
VENDOR IFD TYPE .............. CHIPDRIVE Serial
VENDOR IFD VERSION ........... < no info >
VENDOR IFD SERIAL NO ......... 12639860

Delphi syntax:
function GetReaderInfoFmt(var ReaderName: WideString): WideString;

5.2.11 GetReadersList

Returns the list of the smart card readers' names which are attached to your PC.

Arguments / parameters
<none>

Returns

The function returns the readers names string list.

Returning value data type

C++ : BSTR
Basic : As String
Delphi : WideString

Description

Copyright 2005 by SCardSOFT


66 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

This function returns the list of the readers names which are divided by the line breaks symbols
#13#10 :

AKS ifdh 0
AKS ifdh 1
SCM Microsystems Inc. CHIPDRIVE Serial 0

Delphi syntax:
function GetReadersList: WideString;

5.2.12 IsCardReady

Specifies whether the card in the reader is opened.

Arguments / parameters

Argument Name Data Type Description

ReaderName C++ : BSTR smart card reader name;


Basic : As String
( input ) Delphi : WideString

All arguments are passed by reference.

Returns

The function returns true or false depends to whether the card in the reader is opened.

Returning value data type

C++ : bool
Basic : As Boolean
Delphi : WordBool

Delphi syntax:
function IsCardReady(var ReaderName: WideString): WordBool;

5.2.13 IsLocked

Specifies whether the SCardX Easy is locked for smart card service commands.

Arguments / parameters
<none>

Returns

The function returns true or false depends to whether the SCardX Easy is locked.

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 67

Returning value data type

C++ : bool
Basic : As Boolean
Delphi : WordBool

Delphi syntax:
function IsLocked: WordBool;

5.2.14 LookUpError

Decodes the error string message from its numerical code.

Arguments / parameters

Argument Name Data Type Description

ErrorCodeHex C++ : BSTR the hexadecimal value of an integer error code;


Basic : As String
( input ) Delphi : WideString

All arguments are passed by reference.

Returns

The function returns the decoded error string.

Returning value data type

C++ : BSTR
Basic : As String
Delphi : WideString

Description

You may decode any error value which you need because this function uses the system function of
the your PC operation system.

Delphi syntax:

function LookUpError(var ErrorCodeHex: WideString): WideString;

5.2.15 LookUpReaderState

Decodes the string value of the card reader state from its numerical code.

Arguments / parameters

Copyright 2005 by SCardSOFT


68 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

Argument Name Data Type Description

StateCodeHex C++ : BSTR the hexadecimal value of an integer state code;


Basic : As String
( input ) Delphi : WideString

All arguments are passed by reference.

Returns

The function returns the decoded reader state string list.

Returning value data type

C++ : BSTR
Basic : As String
Delphi : WideString

Description

This function returns the list of the strings which are divided by the line breaks symbols #13#10.

Each state line is formatted as a standart INI file like of this example:
0x00000020=There is a card in the reader
0x00000100=The card in the reader is in use by one or more other applications, but may be
connected to in shared mode

Delphi syntax:
function LookUpReaderState(var StateCodeHex: WideString): WideString;

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 69

5.2.16 ReopenReader

Reopens the reader.

Arguments / parameters

Argument Name Data Type Description

ReaderName C++ : BSTR smart card reader name;


Basic : As String
( input ) Delphi : WideString

All arguments are passed by reference.

Returns
<none>

Delphi syntax:
procedure ReopenReader(var ReaderName: WideString);

5.2.17 SendCardAPDU

Sends the command APDU into the opened smart card and returns the card's answer as a
response APDU.

Arguments / parameters

Copyright 2005 by SCardSOFT


70 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

Argument Name Data Type Description

ReaderName C++ : BSTR smart card reader name;


Basic : As String
( input ) Delphi : WideString

Cla C++ : BSTR the Class hex byte of the command APDU;
Basic : As String
( input ) Delphi : WideString

Ins C++ : BSTR the Instruction hex byte of the command APDU;
Basic : As String
( input ) Delphi : WideString

P1 C++ : BSTR the Parameter 1 hex byte of the command APDU;


Basic : As String
( input ) Delphi : WideString

P2 C++ : BSTR the Parameter 2 hex byte of the command APDU;


Basic : As String
( input ) Delphi : WideString

P3Lc C++ : BSTR the Length hex byte of the command APDU;
Basic : As String
( input ) Delphi : WideString

DataIn C++ : BSTR the Data hex buffer of the command APDU;
Basic : As String
( input ) Delphi : WideString

Le C++ : BSTR the Length hex byte of the command APDU;


Basic : As String
( input ) Delphi : WideString

SW1SW2 C++ : BSTR the Status Word ( status hex bytes 1 and 2) of the
Basic : As String response APDU;
( output ) Delphi : WideString

DataOut C++ : BSTR the Data hex buffer of the response APDU;
Basic : As String
( output ) Delphi : WideString

All arguments are passed by reference.

Returns

The function returns the complete response APDU buffer in a hexadecimal format.

Returning value data type

C++ : BSTR
Basic : As String
Delphi : WideString

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 71

Description

Use this function for sending the command APDU's into an opened smart card and for receiving of
its response APDU's.

Delphi syntax:
function SendCardAPDU(var ReaderName: WideString; var Cla: WideString; var Ins:
WideString; var P1: WideString; var P2: WideString; var P3Lc: WideString; var Le:
WideString; var DataIn: WideString; var SW1SW2: WideString; var DataOut: WideString):
WideString;

5.2.18 SendCardDATA

Sends an unformatted data buffer into the opened card and returns the unformatted card's answer.

Arguments / parameters

Argument Name Data Type Description

ReaderName C++ : BSTR smart card reader name;


Basic : As String
( input ) Delphi : WideString

SentDataBuffer C++ : BSTR an unformatted send data buffer in a hexadecimal format;


Basic : As String
( input ) Delphi : WideString

All arguments are passed by reference.

Returns

The function returns an unformatted buffer of the card response data in a hexadecimal format.

Returning value data type

C++ : BSTR
Basic : As String
Delphi : WideString

Description

Use this function for sending an unformatted data into an opened smart card.

Delphi syntax:
function SendCardDATA(var ReaderName: WideString; var SentDataBuffer: WideString):
WideString;

Copyright 2005 by SCardSOFT


72 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

5.2.19 SetPref_PCSC_OnCardDetect

Sets up the card detecting defaults for using of the MS Smart Card service.

Arguments / parameters

Argument Name Data Type Description

AutoOpenReader C++ : bool determines w hether the card will be opened after
Basic : As Boolean detection;
( input ) Delphi : WordBool

PreferredProtocol C++ : int determines the preferred protocol which will be used for
Basic : As Long the card opening;
( input ) Delphi : Integer

PreferredSharingMode C++ : int determines the reader sharing mode which will be used
Basic : As Long for the card opening;
( input ) Delphi : Integer

CardClosingMode C++ : int determines the card closing mode which will be used by
Basic : As Long the command ReopenReader ;
( input ) Delphi : Integer

All arguments are passed by reference.

Returns
<none>

Description

Use this command for setting up the card detecting defaults via control's interface.

These preferences' changes becomes visible on the "States" page after calling of this function
immediately:

Possible values:
PreferredProtocol
xProto_Autodetect = $00000000
xProto_T0 = $00000001
xProto_T1 = $00000002
xProto_RAW = $00000003

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 73

xProto_Undefined = $00000004
xProto_Default = $00000005

PreferredSharingMode
xSharing_ShareReader = $00000000
xSharing_ExclusiveUse = $00000001
xSharing_DirectReaderControl = $00000002

CardClosingMode
xClosing_LeaveCard = $00000000
xClosing_ResetCard = $00000001
xClosing_UnpowerCard = $00000002
xClosing_EjectCard = $00000003

Delphi syntax:
type TxProtocol = TOleEnum;
type TxSharingMode = TOleEnum;
type TxCardClosingMode = TOleEnum;

procedure SetPref_PCSC_OnCardDetect(var AutoOpenReader: WordBool;var PreferredProtocol:


TxProtocol; var PreferredSharingMode: TxSharingMode; var CardClosingMode:
TxCardClosingMode);

5.2.20 TrayIconMenuClear

Clears the SCardX Easy tray icon's pop-up menu.

Arguments / parameters
<none>

Returns
<none>

Delphi syntax:
procedure TrayIconMenuClear;

Copyright 2005 by SCardSOFT


74 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

5.2.21 TrayIconMenuCreate

Creates the new pop-up menu of the SCardX Easy's tray icon.

Arguments / parameters

Argument Name Data Type Description

MenuItemsList C++ : BSTR the string list of the new menu items' templates;
Basic : As String
( input ) Delphi : WideString

All arguments are passed by reference.

Returns
<none>

Description

Before calling of this function you need to prepare the menu items' list according to these rules:

all strings in this list are divided by the line breaks symbols #13#10 ;
each new line in the list is the new menu item template;
each menu item template consists of two parts;
the menu item ID ;
the menu item caption ;
these two parts of the menu item template are divided by the "=" character;
if the menu item template begins with a "-" character the menus divider will be created;

For example your menu items list may be prepared like this one:

ID_1=My Menu Item 1


----
ID_2=My Menu Item 2
ID_3=My Menu Item 3

These new menu items becomes visible into the tray icon's pop-up menu immediately after calling
of this function:

Delphi syntax:
procedure TrayIconMenuCreate(var MenuItemsList: WideString);

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 75

5.2.22 TrayIconMenuItemSetChecked

Makes the menu item of the tray icon's pop-up menu as checked or unchecked.

Arguments / parameters

Argument Name Data Type Description

ItemID C++ : BSTR the ID string of the menu item which was defined by the
Basic : As String TrayIconMenuCreate function;
( input ) Delphi : WideString

IsChecked C++ : bool the checking flag;


Basic : As Boolean
( input ) Delphi : WordBool

All arguments are passed by reference.

Returns

The function returns true if the menu item was found and the command was successful.

Returning value data type

C++ : bool
Basic : As Boolean
Delphi : WordBool

Description

Use this function for marking of the created menu items as checked or unchecked:

Delphi syntax:
function TrayIconMenuItemSetChecked(var ItemID: WideString; var IsChecked: WordBool):
WordBool;

Copyright 2005 by SCardSOFT


76 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

5.2.23 TrayIconMenuItemSetDefault

Makes the menu item of the tray icon's pop-up menu as default or standart.

Arguments / parameters

Argument Name Data Type Description

ItemID C++ : BSTR the ID string of the menu item which was defined by the
Basic : As String TrayIconMenuCreate function;
( input ) Delphi : WideString

IsDefault C++ : bool the default item flag;


Basic : As Boolean
( input ) Delphi : WordBool

All arguments are passed by reference.

Returns

The function returns true if the menu item was found and the command was successful.

Returning value data type

C++ : bool
Basic : As Boolean
Delphi : WordBool

Description

Use this function for marking of the created menu items as default or standart:

Delphi syntax:
function TrayIconMenuItemSetDefault(var ItemID: WideString; var IsDefault: WordBool):
WordBool;

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 77

5.2.24 TrayIconMenuItemSetEnabled

Makes the menu item of the tray icon's pop-up menu as enabled or disabled.

Arguments / parameters

Argument Name Data Type Description

ItemID C++ : BSTR the ID string of the menu item which was defined by the
Basic : As String TrayIconMenuCreate function;
( input ) Delphi : WideString

IsEnabled C++ : bool the enabling flag;


Basic : As Boolean
( input ) Delphi : WordBool

All arguments are passed by reference.

Returns

The function returns true if the menu item was found and the command was successful.

Returning value data type

C++ : bool
Basic : As Boolean
Delphi : WordBool

Description

Use this function for marking of the created menu items as enabled or disabled:

Delphi syntax:

function TrayIconMenuItemSetEnabled(var ItemID: WideString; var IsEnabled: WordBool):


WordBool;

Copyright 2005 by SCardSOFT


78 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

5.2.25 Version

Returns the SCardX Easy version string.

Arguments / parameters
<none>

Returns

The function returns the full version string like : Version 1.3

Returning value data type

C++ : BSTR
Basic : As String
Delphi : WideString

Delphi syntax:

function Version: WideString;

5.2.26 VersionMajor

Returns the major digit of the SCardX Easy ActiveX control version.

Arguments / parameters
<none>

Returns

The function returns the integer value of the major digit of the control's version.

Returning value data type

C++ : int
Basic : As Long
Delphi : Integer

Delphi syntax:
function VersionMajor: Integer;

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 79

5.2.27 VersionMinor

Returns the minor digit of the SCardX Easy ActiveX control version.

Arguments / parameters
<none>

Returns

The function returns The integer value of the minor digit of the control's version.

Returning value data type

C++ : int
Basic : As Long
Delphi : Integer

Delphi syntax:

function VersionMinor: Integer;

Copyright 2005 by SCardSOFT


80 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

5.3 Events

User interface events

OnHistoryEvent
OnReaderSelected
OnTrayIconDblClick
OnTrayIconMenuItem

Smart card work events

OnCardDetected
OnCardInvalid
OnCardReady
OnCardWait
OnConnected
OnDataSent
OnDisconnected
OnReadersList
OnReaderStateChanged

Other events

OnERROR
OnLock
OnUnlock

5.3.1 OnCardDetected

Occurs when the card was detected in the reader.

Arguments / parameters

Argument Name Data Type Description

ReaderName C++ : BSTR smart card reader name;


Basic : As String
( output ) Delphi : WideString

All arguments are passed by reference.

Delphi syntax:
TSCardX_EasyOnCardDetected = procedure (ASender: TObject; var ReaderName: WideString) of

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 81

object;

property OnCardDetected: TSCardX_EasyOnCardDetected;

5.3.2 OnCardInvalid

Occurs when the card was detected in the reader but the reader was not able to open it.

Arguments / parameters

Argument Name Data Type Description

ReaderName C++ : BSTR smart card reader name;


Basic : As String
( output ) Delphi : WideString

All arguments are passed by reference.

Delphi syntax:
TSCardX_EasyOnCardInvalid = procedure (ASender: TObject; var ReaderName: WideString) of
object;

property OnCardInvalid: TSCardX_EasyOnCardInvalid;

5.3.3 OnCardReady

Occurs when the card was detected and successfully opened in the reader.

Arguments / parameters

Argument Name Data Type Description

ReaderName C++ : BSTR smart card reader name;


Basic : As String
( output ) Delphi : WideString

ATR C++ : BSTR the ATR string of an opened card;


Basic : As String
( output ) Delphi : WideString

ProtocolValue C++ : int the real active protocol code of an opened card;
Basic : As Long
( output ) Delphi : Integer

Protocol C++ : BSTR the real active protocol name of an opened card;
Basic : As String
( output ) Delphi : WideString

All arguments are passed by reference.

Copyright 2005 by SCardSOFT


82 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

Delphi syntax:
TSCardX_EasyOnCardReady = procedure (ASender: TObject; var ReaderName: WideString; var
ATR: WideString; var ProtocolValue: Integer; var Protocol: WideString) of object;

property OnCardReady: TSCardX_EasyOnCardReady;

5.3.4 OnCardWait

Occurs when the card was removed from the reader.

Arguments / parameters

Argument Name Data Type Description

ReaderName C++ : BSTR smart card reader name;


Basic : As String
( output ) Delphi : WideString

All arguments are passed by reference.

Delphi syntax:
TSCardX_EasyOnCardWait = procedure (ASender: TObject; var ReaderName: WideString) of
object;

property OnCardWait: TSCardX_EasyOnCardWait;

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 83

5.3.5 OnConnected

Occurs when the smart card service was successfully connected by SCardX Easy.

Arguments / parameters

Argument Name Data Type Description

Service C++ : int the connected service code;


Basic : As Long
( output ) Delphi : Integer

All arguments are passed by reference.

Possible values:
srv_MS_PCSC_SCard_Service = $00000001

Delphi syntax:

TSCardX_EasyOnConnected = procedure (ASender: TObject; var Service: Integer) of object;

property OnConnected: TSCardX_EasyOnConnected;

Copyright 2005 by SCardSOFT


84 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

5.3.6 OnDataSent

Occurs when the data was successfully sent into the opened smart card.

Arguments / parameters

Argument Name Data Type Description

ReaderName C++ : BSTR smart card reader name;


Basic : As String
( output ) Delphi : WideString

SentDataBuffer C++ : BSTR an unformatted sent data buffer in a hexadecimal format;


Basic : As String
( output ) Delphi : WideString

ReceivedDataBuffer C++ : BSTR an unformatted received data buffer in a hexadecimal


Basic : As String format;
( output ) Delphi : WideString

All arguments are passed by reference.

Delphi syntax:
TSCardX_EasyOnDataSent = procedure (ASender: TObject; var ReaderName: WideString; var
SentDataBuffer: WideString; var ReceivedDataBuffer: WideString) of object;

property OnDataSent: TSCardX_EasyOnDataSent;

5.3.7 OnDisconnected

Occurs when the smart card service was disconnected.

Arguments / parameters
<none>

Delphi syntax:
TNotifyEvent = procedure(Sender: TObject) of object;

property OnDisconnected: TNotifyEvent;

5.3.8 OnERROR

Occurs when the error was detected.

Arguments / parameters

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 85

Argument Name Data Type Description

ErrorSource C++ : BSTR the source where an error was detected by SCardX Easy;
Basic : As String
( output ) Delphi : WideString

ErrorCode C++ : int the integer error code value;


Basic : As Long
( output ) Delphi : Integer

ErrorString C++ : BSTR the decoded error string;


Basic : As String
( output ) Delphi : WideString

All arguments are passed by reference.

Delphi syntax:

TSCardX_EasyOnERROR = procedure(ASender: TObject; var ErrorSource: WideString; var


ErrorCode: Integer; var ErrorString: WideString) of object;

property OnERROR: TSCardX_EasyOnERROR;

Copyright 2005 by SCardSOFT


86 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

5.3.9 OnHistoryEvent

Occurs when the new event was added into the events grid of the "Events History" page.

Arguments / parameters

Argument Name Data Type Description

EventID C++ : int the number of the event line;


Basic : As Long
( output ) Delphi : Integer

EventSource C++ : BSTR the source of the event;


Basic : As String
( output ) Delphi : WideString

EventBody C++ : BSTR the event body message;


Basic : As String
( output ) Delphi : WideString

EventValue C++ : BSTR the additional event info;


Basic : As String
( output ) Delphi : WideString

EventTime C++ : BSTR the event time;


Basic : As String
( output ) Delphi : WideString

All arguments are passed by reference.

Description

All parameters of this event are equal to the columns values of the events grid of the "Events
History" page.

Delphi syntax:
TSCardX_EasyOnHistoryEvent = procedure(ASender: TObject; var EventID: Integer; var
EventSource: WideString; var EventBody: WideString; var EventValue: WideString; var
EventTime: WideString) of object;

property OnHistoryEvent: TSCardX_EasyOnHistoryEvent;

5.3.10 OnLock

Occurs when the communication data exchange between the SCardX Easy and smart card
service is active.

Arguments / parameters

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 87

Argument Name Data Type Description

Message C++ : BSTR the string message about the current active operation;
Basic : As String
( output ) Delphi : WideString

All arguments are passed by reference.

Delphi syntax:
TSCardX_EasyOnLock = procedure(ASender: TObject; var Message: WideString) of object;

property OnLock: TSCardX_EasyOnLock;

5.3.11 OnReaderSelected

Occurs when the user has selected the reader on the "States" page by mouse clicking on its item.

Arguments / parameters

Argument Name Data Type Description

ReaderName C++ : BSTR smart card reader name;


Basic : As String
( output ) Delphi : WideString

All arguments are passed by reference.

Delphi syntax:

TSCardX_EasyOnReaderSelected = procedure(ASender: TObject; var ReaderName: WideString)


of object;

property OnReaderSelected: TSCardX_EasyOnReaderSelected;

5.3.12 OnReadersList

Occurs when the SCardX Easy receives the readers list from the smart card service.

Arguments / parameters

Argument Name Data Type Description

ReadersList C++ : BSTR the list of the readers names which are divided by the line
Basic : As String breaks symbols #13#10 ;
( output ) Delphi : WideString

All arguments are passed by reference.

Copyright 2005 by SCardSOFT


88 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

Delphi syntax:
TSCardX_EasyOnReadersList = procedure(ASender: TObject; var ReadersList: WideString) of
object;

property OnReadersList: TSCardX_EasyOnReadersList;

5.3.13 OnReaderStateChanged

Occurs when the reader state was changed.

Arguments / parameters

Argument Name Data Type Description

ReaderName C++ : BSTR smart card reader name;


Basic : As String
( output ) Delphi : WideString

ReaderState C++ : BSTR the new reader state integer code;


Basic : As String
( output ) Delphi : WideString

ReaderStateHex C++ : int the new reader state hex code;


Basic : As Long
( output ) Delphi : Integer

ReaderStateLookup C++ : BSTR the decoded new reader state string list; the strings are
Basic : As String divided by the line breaks symbols #13#10 ;
( output ) Delphi : WideString

All arguments are passed by reference.

Delphi syntax:
TSCardX_EasyOnReaderStateChanged = procedure(ASender: TObject; var ReaderName:
WideString; var ReaderState: Integer; var ReaderStateHex: WideString; var
ReaderStateLookup: WideString) of object;

property OnReaderStateChanged: TSCardX_EasyOnReaderStateChanged;

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification 89

5.3.14 OnTrayIconDblClick

Occurs when the user double clicks on the tray icon of the SCardX Easy.

Arguments / parameters
<none>

Delphi syntax:
TNotifyEvent = procedure(Sender: TObject) of object;

property OnTrayIconDblClick: TNotifyEvent;

5.3.15 OnTrayIconMenuItem

Occurs when the user clicks on the menu item of the tray icon's pop-up menu.

Arguments / parameters

Argument Name Data Type Description

ItemID C++ : BSTR the menu item ID string;


Basic : As String
( output ) Delphi : WideString

IsChecked C++ : bool the item checked flag;


Basic : As Boolean
( output ) Delphi : WordBool

IsEnabled C++ : bool the item enabled flag;


Basic : As Boolean
( output ) Delphi : WordBool

IsDefault C++ : bool the item default flag;


Basic : As Boolean
( output ) Delphi : WordBool

Caption C++ : BSTR the item caption;


Basic : As String
( output ) Delphi : WideString

All arguments are passed by reference.

Delphi syntax:
TSCardX_EasyOnTrayIconMenuItem = procedure(ASender: TObject; var ItemID: WideString; var
IsChecked: WordBool; var IsEnabled: WordBool; var IsDefault: WordBool; var Caption:
WideString) of object;

property OnTrayIconMenuItem: TSCardX_EasyOnTrayIconMenuItem;

Copyright 2005 by SCardSOFT


90 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) SCardX Easy interface specification

5.3.16 OnUnlock

Occurs when the communication data exchange between the SCardX Easy and smart card
service was done and the control becomes ready for a new command.

Arguments / parameters
<none>

Delphi syntax:
TNotifyEvent = procedure(Sender: TObject) of object;

property OnUnlock: TNotifyEvent;

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Registration 91

6 Registration

6.1 Unregistered version limitations

Unregistered version of a SCardX Easy ActiveX control works as a demo version only.

These are the unregistered version limitations:

1. your program can send only from 7 up to 10 commands to a smart card per each SCardX Easy
start;
2. the SCardX Easy shows unregistered version's reminders in the following areas:
in the License info item of the "States" page;
in the hint of the tray icon;
in the balloon of the tray icon;
3. you can't to hide the tray icon;
4. you may not contact the SCardX Easy support service;

6.2 Licensing
6.2.1 End-User Licenses

If you don't plan to re-distribute SCardX Easy ActiveX control in this case you may purchase one of
our End-User Licenses:

1. End-User Personal License - personal usage by a single user;


2. End-User Site License - unlimited usage at a single company;

Licences Prices
Purchase the Personal License
Purchase the Site License

End-User Personal License

Unlimited personal usage by a single user.

You may create your own applications using SCardX Easy ActiveX control and to use its by
yourself unlimited:

license owner may create and unlimited use his own applications which are based on the SCardX Easy
ActiveX control for his own personal tasks only;
any re-distributions are not allowed;

Registered Users Rights :

After purchasing of the End-User Personal License you will be able:

to unblock your copy of the SCardX Easy ActiveX control by your own Registration Certificate;
to upgrade the new versions of the SCardX Easy ActiveX control for only 50% of the base price of the
Personal License;
to contact our support service for any questions about the SCardX Easy ActiveX control functionality
or about the smart cards basics;

Copyright 2005 by SCardSOFT


92 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Registration

End-User Site License


Unlimited usage at the single company

By purchasing of this license you grants the SCardX Easy ActiveX control and all smart cards
applications which are based on this ActiveX to all your developers and to all your company's
staff at once.

For example SCardX Easy ActiveX control may be used by your corporate intranet smart cards
oriented web site or by others your corporate smart cards applications:

anybody may use the applications which are based on the SCardX Easy ActiveX control at the any of
computers of a company which is an owner of this license;
any re-distributions are not allowed;

Registered Users Rights :

After purchasing of the End-User Site License you will be able:

to unblock your copy of the SCardX Easy ActiveX control by your own Registration Certificate;
to upgrade the new versions of the SCardX Easy ActiveX control for only 50% of the base price of the
Site License;
to request the custom setup packs of the SCardX Easy ActiveX control like the web installation for
free;
to request the custom builds of the SCardX Easy ActiveX control according to your tasks; it may cost
more depending on the requested functionality;
to contact our support service for any questions about the SCardX Easy ActiveX control functionality
or about the smart cards basics;

6.2.2 Developers Licenses

You may unlimited re-distribute SCardX Easy ActiveX control as a part of your own software
solutions. In this case you may purchase one of our Developer's Licenses:

1. Base Developer's License - unlimited re-distribution without source codes;


2. Developer's License SC - unlimited re-distribution with source codes included;
3. Developer's License FULL - unlimited re-distribution without copyright limitations;

Licences Prices

Base Developers License


Unlimited re-distribution without source codes

Any developer(s) may create applications using SCardX Easy ActiveX control and the licence
owner may sale these applications unlimited without any additional payments to SCardSOFT:

license owner may create, unlimited use and unlimited distribute the applications which are based
on the SCardX Easy ActiveX control;
re-distribution of SCardX Easy ActiveX control allowed as a part of license owner's software without
any additional payments to SCardSOFT;
all rights on the SCardX Easy ActiveX control are reserved by its author;

Developers License SC
Unlimited re-distribution with source codes included

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Registration 93

Any developer(s) may create applications using SCardX Easy ActiveX control and the licence
owner may sale these applications unlimited without any additional payments to SCardSOFT:

license owner may create, unlimited use and unlimited distribute the applications which are based
on the SCardX Easy ActiveX control;
re-distribution of SCardX Easy ActiveX control allowed as a part of license owner's software without
any additional payments to SCardSOFT;
all rights on the SCardX Easy ActiveX control are reserved by its author;

full source codes of SCardX Easy ActiveX control are included;


the copyright information of the SCardX Easy ActiveX control must be always included in the license
of the software which uses the SCardX Easy ActiveX control;

Developer License FULL


Unlimited re-distribution without copyright limitations

Any developer(s) may create applications using SCardX Easy ActiveX control and the licence
owner may sale these applications unlimited without any additional payments to SCardSOFT:

license owner may create, unlimited use and unlimited distribute the applications which are based on
the SCardX Easy ActiveX control;
re-distribution of SCardX Easy ActiveX control allowed as a part of license owner's software without
any additional payments to SCardSOFT;
all rights on the SCardX Easy ActiveX control are reserved by its author;

full source codes of SCardX Easy ActiveX control are included except of our shareware security
subsystem;
no copyright limitations are present; the control may be re-distributed without our copyright
information visible;

6.2.3 Custom versions

What software you can order?


Additionally to our base solutions you can order the following custom software according to your
specific tasks:
custom versions of the SCardX Easy ActiveX control control;
custom versions of the Smart Card ToolSet program;
new smart card ActiveX controls;
new smart card software;

How much does it cost?


The minimal fee for custom software order is a cost of the Site License. The real cost of your order
will be calculated according to the requested functionality.

Please be ready to support us additionally, in the case if it will be necessary, by the following:
a device(s) which will be used by an ordered software;
smart cards which will be used by an ordered software;
a device(s) and cards specification(s);

Terms
Our terms of a software creating are from two weeks up to some month depend on the requested
functionality.

Copyright 2005 by SCardSOFT


94 Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Registration

How to order?
Please read in details how to order a custom software versions on our web site .

6.3 Registration steps


6.3.1 Step 1 : License Query

Run the program "SCardX Easy Control Center " from the start menu and make the following:

open the "Registration " page;


select "Step 1 : I want now to create the License Query for receiving the Registration
Certificate" and press on the "Go to Step 1 : Create the License Query" button;
fill up all information fields inside the "License Query Maker" window depending to the type of the
License which you need and press on the "Make Query " button;
Open the "License Query " page; there is the License Query's body text there;
copy the License Query's text into a new e-mail letter and send it to SCardSOFT via e-mail:
[email protected] ;

We will send you your own Registration Certificate after receiving of your money and after receiving
of your License Query during a one working day.

6.3.2 Step 2 : Purchasing the License

You can purchase the License on-line by your credit card.

Your payment will be processed by the Share-It! (Germany) internet payments' service on the
highest security level via a secure SSL connection.

Licences Prices
Purchase the License just now

Additionally we accepts the WebMoney and other transfers.

Read more how to purchase the License

We will send you your own Registration Certificate after receiving of your money and after receiving
of your License Query during a one working day.

6.3.3 Step 3 : Certificate registration

Copy the text of the Registration Certificate from the received our letter into a memory by "Copy "
command.

Run the program "SCardX Easy Control Center " from the start menu and make the following:

open the "Registration " page;


select "Step 3 : I already have my own Certificate and now I want to register the SCardX
control" and press on the "Go to Step 3 : Register the SCardX Easy control" button;
paste the copied text of the received Registration Certificate into an opened "Certificate
Registration Form" using the "Paste" button;
register the program by pressing on the "Register SCardX Easy" button.

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Index

Index DES Decrypting 58


DES Encrypting 58
DES_DecryptString function 58
DES_EncryptString function 58
Disconnection example 27
-"-
"Hello cards World !" 43 -E-
Error message 84
-A- Events History receiving 63
Events list 80
About 4 Events logging enabling/disabling 51
ActivePage property 47 Events logging mode 52
Adding SCardX Easy to application 22 Events receiving example 24
APDU 43 EventsHistoryClear function 59
Application shutdown example 43 EventsHistoryEnabled property 51
Application startup example 42 EventsLogging property 52
ATR string receiving 60 Examples path 21

-B- -F-
BorderStyle property 49 Finalize example 43
BorderWidth property 49 Finalize function 60
First application : "Hello cards World !" 43
-C- First application : Application shutdown 43
First application : Application startup 42
Card Closing Mode example 40 First application : Card detecting defaults 40
Card detecting defaults example 40 First application : Connection controls 27
Card detecting defaults setting up 72 First application : Data ciphering 39
Card Info example 29 First application : Events 24
Card Info receiving 61 First application : Interface functions 22
Card Info receiving formatted 61 First application : LookUp 38
Card state checking 66 First application : New Project 22
Clearing the Events History 59 First application : Opened reader controls 29
Command APDU 43 First application : Tray Icon 34
Command APDU sending 69 First start 16
Command APDU sending example 29 Functions list 57
Connecting the service 51
Connection example 27
Connection testing 16 -G-
ConnectionState property 51 GetCardATR function 60
Contacts 4 GetCardInfo function 61
GetCardInfoFmt function 61
-D- GetEventsHistory function 63
GetReaderInfo function 64
Delphi component registration 14 GetReaderInfoFmt function 64
Delphi components palette 14 GetReadersList function 65
Demo Application 21 GSM11.11 43
DES decoding and encoding example 39

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Index

Registration : Developers Licenses 92

-I- Registration : End-User Licenses 91


Registration of the ActiveX control 14
IsCardReady function 66 Registration Step 1 : License Query 94
IsLocked function 66 Registration Step 2 : Purchasing the License 94
ISO-7816 43 Registration Step 3 : Certificate registration 94
Reopen Reader 69

-L- Reopen reader example 29


ReopenReader function 69
Locked control checking 66 Response APDU 43
LookUp Error code 67
LookUp error code example 38
LookUp Reader State code 67
-S-
LookUp reader state code example 38 SendCardAPDU function 69
LookUpError function 67 SendCardDATA function 71
LookUpReaderState function 67 SeparateReceivedBytes property 52
Separating the received HEX bytes 52

-O- SetPref_PCSC_OnCardDetect function 72


Show / hide the EventsHistory 54
OnCardDetected event 80 Show / hide the StatusBar 55
OnCardInvalid event 81 Show / hide the ToolBar 55
OnCardReady event 81 Show / hide the Tray Icon 56
OnCardWait event 82 Smart card service selecting 53
OnConnected event 83 SmartCardService property 53
OnDataSent event 84 Status word 43
OnDisconnected event 84 SW1SW2 43
OnERROR event 84
OnHistoryEvent event 86
OnLock event 86
-T-
OnReaderSelected event 87 Tray Icon double click event 89
OnReadersList event 87 Tray Icon example 34
OnReaderStateChanged event 88 Tray Icon Menu : Clearing 73
OnTrayIconDblClick event 89 Tray Icon Menu : Creating new 74
OnTrayIconMenuItem event 89 Tray Icon Menu Item : checked / unchecked 75
OnUnlock event 90 Tray Icon Menu Item : default / standart 76
Tray Icon Menu Item : enabled / disabled 77

-P- Tray Icon Menu Item : events receiving 89


TrayIconMenuClear function 73
Preferred Protocol example 40 TrayIconMenuCreate function 74
Preferred Sharing Mode example 40 TrayIconMenuItemSetChecked function 75
Properties list 47 TrayIconMenuItemSetDefault function 76
TrayIconMenuItemSetEnabled function 77
-R-
Reader Info example 29 -U-
Reader Info receiving 64 Unformatted data buffer sending 71
Reader Info receiving formatted 64 Unformatted data buffers sending example 29
Readers list receiving 65 Unregistered version limitations 91
Readers list receiving example 27

Copyright 2005 by SCardSOFT


Smart Cards in the Delphi applications. Developers Manual ( Document ver.1.4, Dec. 22, 2005 ) Index

-V-
Version function 78
Version Major digit receiving 78
Version Minor digit receiving 79
Version string receiving 78
VersionMajor function 78
VersionMinor function 79
Visible property 53
VisibleEventsHistory property 54
VisibleStatusBar property 55
VisibleToolBar property 55
VisibleTrayIcon property 56

Copyright 2005 by SCardSOFT

You might also like