---
product: Chilkat
product_version: 11.7.0
language: b4x
language_label: B4X
class: SCard
class_name: ChilkatSCard
license: bundle
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/b4x_SCardRef.html
---
# Chilkat SCard — B4X — v11.7.0

> Chilkat 11.7.0 · language=b4x · class=SCard (ChilkatSCard)
> Other versions: replace `11.7.0` in this URL. Other languages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/<lang>/classes/SCard.md`.
> Language-wide rules (install, unlock, error model, strings/bytes): `https://www.chilkatsoft.com/ai-docs/v/11.7.0/b4x/guide.md`.

## Purpose

**Communicate directly with smart card readers and cards through PC/SC.**

`Chilkat.SCard` is the low-level PC/SC smart card interface for applications that need direct reader and card communication. It supports reader discovery, reader connection, card status checking, APDU transmission, reader-control commands, status-change monitoring, transactions, and diagnostic access to underlying PC/SC errors. Use this class when the application needs APDU-level control rather than a higher-level certificate, minidriver, or PKCS#11 abstraction.

**Reader discovery**

Enumerate available PC/SC smart card readers and identify the reader the application should use.

**Connect to cards**

Connect to a reader/card, check card presence and status, and manage the active PC/SC connection.

**Transmit APDUs**

Send APDU commands directly to the card and receive the raw response bytes and status words.

**Reader-control commands**

Issue lower-level reader control commands when supported by the reader driver and PC/SC environment.

**Status monitoring**

Monitor reader or card status changes so applications can detect card insertion, removal, or state changes.

**Transactions and diagnostics**

Use PC/SC transactions for coordinated card access and inspect detailed error information when reader or card operations fail.

**Common pattern:** Establish the PC/SC context, list readers, connect to the selected reader, check card status, transmit APDU commands, process the response bytes, and disconnect when finished. Use `Chilkat.SCard` for direct PC/SC reader and APDU-level work; use `Chilkat.ScMinidriver` for card-minidriver certificate and key-container operations, and `Chilkat.Pkcs11` for PKCS#11 token or HSM sessions.

For an extended overview, see [SCard Class Overview](https://www.chilkatsoft.com/scard_class_overview.asp).

## Object creation, unlocking and error handling

**Declare / Initialize / Dispose**

```visual-basic
Sub Process_Globals
    Private obj As ChilkatSCard
End Sub

' Call Initialize before first use -- typically in AppStart (B4J)
' or Activity_Create (B4A):
obj.Initialize                ' classes without events
obj.Initialize("evt")        ' classes with events: "evt" becomes the
                              ' prefix of event Subs such as evt_PercentDone
```

`Initialize / Initialize (EventName As String)`

Creates the underlying native Chilkat object. Classes that support events take an `EventName` argument: it becomes the prefix of the event Subs (`<EventName>_AbortCheck`, `<EventName>_PercentDone`, `<EventName>_ProgressInfo`); classes without events take no arguments. The native Chilkat library loads automatically on the first Initialize — from the APK on Android, or extracted from ChilkatB4J.jar on Windows/Linux/macOS.

`IsInitialized As Boolean`

`True` if `Initialize` has been called and the native object exists.

`Dispose`

Explicitly frees the underlying native object. Calling `Dispose` is optional — every ChilkatSCard is also freed automatically when garbage-collected — but is recommended for long-lived objects holding sockets, sessions, or large buffers. A disposed object can be re-Initialized.

Call `Global.UnlockBundle` once at the start of the program, before using this or any other Chilkat class. Any string unlocks a fully functional 30-day trial; a purchased unlock code is used in production. See `guide.md` for the exact code in B4X.

## Members common to every Chilkat class

Documented once per language in `common-members.md`; listed here so this page is self-contained.

| Property | Signature | Access | Meaning |
|---|---|---|---|
| `DebugLogFilePath` | `' read/write DebugLogFilePath As String` | read/write | If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. |
| `LastErrorHtml` | `' read-only LastErrorHtml As String` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `' read-only LastErrorText As String` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `' read-only LastErrorXml As String` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `' read/write LastMethodSuccess As Boolean` | read/write | Indicates the success or failure of the most recent method call: `True` means success, `False` means failure. |
| `VerboseLogging` | `' read/write VerboseLogging As Boolean` | read/write | If set to `True`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `' read-only Version As String` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `ActiveProtocol` | property, read-only | `' read-only ActiveProtocol As String` |
| `CardAtr` | property, read-only | `' read-only CardAtr As String` |
| `ConnectedReader` | property, read-only | `' read-only ConnectedReader As String` |
| `Context` | property, read-only | `' read-only Context As String` |
| `PcscLibPath` | property, read/write | `' read/write PcscLibPath As String` |
| `ReaderStatus` | property, read-only | `' read-only ReaderStatus As String` |
| `ScardError` | property, read-only | `' read-only ScardError As String` |
| `BeginTransaction` | method | `BeginTransaction As Boolean` |
| `CheckStatus` | method | `CheckStatus As Boolean` |
| `Connect` | method | `Connect (reader As String, shareMode As String, preferredProtocol As String) As Boolean` |
| `Disconnect` | method | `Disconnect (disposition As String) As Boolean` |
| `EndTransaction` | method | `EndTransaction (disposition As String) As Boolean` |
| `EstablishContext` | method | `EstablishContext (scope As String) As Boolean` |
| `FindSmartcards` | method | `FindSmartcards (json As ChilkatJsonObject) As Boolean` |
| `GetAttrib` | method | `GetAttrib (attr As String, bd As ChilkatBinData) As Boolean` |
| `GetAttribStr` | method | `GetAttribStr (attr As String) As String` |
| `GetAttribUint` | method | `GetAttribUint (attr As String) As Long` |
| `GetStatusChange` | method | `GetStatusChange (maxWaitMs As Int, stReaderNames As ChilkatStringTable, json As ChilkatJsonObject) As Boolean` |
| `GetStatusChangeCancel` | method | `GetStatusChangeCancel As Boolean` |
| `ListReaderGroups` | method | `ListReaderGroups (readerGroups As ChilkatStringTable) As Boolean` |
| `ListReaders` | method | `ListReaders (st As ChilkatStringTable) As Boolean` |
| `Reconnect` | method | `Reconnect (shareMode As String, preferredProtocol As String, action As String) As Boolean` |
| `ReleaseContext` | method | `ReleaseContext As Boolean` |
| `SendControl` | method | `SendControl (controlCode As Long, bdSend As ChilkatBinData, bdRecv As ChilkatBinData) As Boolean` |
| `SendControlHex` | method | `SendControlHex (controlCode As Long, sendData As String, bdRecv As ChilkatBinData) As Boolean` |
| `Transmit` | method | `Transmit (protocolName As String, bdSend As ChilkatBinData, bdRecv As ChilkatBinData, maxRecvLen As Int) As Boolean` |
| `TransmitHex` | method | `TransmitHex (protocolName As String, apduHex As String, bdRecv As ChilkatBinData, maxRecvLen As Int) As Boolean` |

## Properties

### SCard.ActiveProtocol

`Chilkat 11.7.0 · b4x · SCard · ActiveProtocol · property · read-only · since 9.50.87`

```visual-basic
' read-only

ActiveProtocol As String
```

The name of the active protocol if connected smart card reader, or an empty string if not connected. Possible values are `T0`, `T1`, `raw`, `undefined`, or if not connected to a reader.

### SCard.CardAtr

`Chilkat 11.7.0 · b4x · SCard · CardAtr · property · read-only · since 9.50.87`

```visual-basic
' read-only

CardAtr As String
```

This is the Current ATR of a card in the connected reader.

### SCard.ConnectedReader

`Chilkat 11.7.0 · b4x · SCard · ConnectedReader · property · read-only · since 9.50.87`

```visual-basic
' read-only

ConnectedReader As String
```

The name of the currently connected smart card reader, or an empty string if not connected.

### SCard.Context

`Chilkat 11.7.0 · b4x · SCard · Context · property · read-only · since 9.50.87`

```visual-basic
' read-only

Context As String
```

Contains the string `user` or `system` if this object has established a context (by calling EstablishContext). Contains the empty string if no context is established.

### SCard.PcscLibPath

`Chilkat 11.7.0 · b4x · SCard · PcscLibPath · property · read/write · since 9.50.87`

```visual-basic
' read/write

PcscLibPath As String
```

For Linux systems only. Specifies the full path of the libpcsclite.so shared lib. This property should only be used if the libpcsclite.so is in a non-standard location or if Chilkat cannot automatically located it.

### SCard.ReaderStatus

`Chilkat 11.7.0 · b4x · SCard · ReaderStatus · property · read-only · since 9.50.87`

```visual-basic
' read-only

ReaderStatus As String
```

The current status of the connected reader. Possible values are:

- `absent` - There is no card in the reader.
- `present` - There is a card in the reader, but it has not been moved into position for use.
- `swallowed` - There is a card in the reader in position for use. The card is not powered.
- `powered` - Power is being provided to the card, but the reader driver is unaware of the mode of the card.
- `negotiable` - The card has been reset and is awaiting PTS negotiation.
- `specific` - The card has been reset and specific communication protocols have been established.

### SCard.ScardError

`Chilkat 11.7.0 · b4x · SCard · ScardError · property · read-only · since 9.50.87`

```visual-basic
' read-only

ScardError As String
```

The last error returned by an underlying PC/SC function. Can be one of the following:

- `SCARD_W_REMOVED_CARD` - The smart card has been removed, so that further communication is not possible.
- `SCARD_W_RESET_CARD` - The smart card has been reset, so any shared state information is invalid.
...

## Methods

### SCard.BeginTransaction

`Chilkat 11.7.0 · b4x · SCard · BeginTransaction · method · since 9.50.87`

```visual-basic
BeginTransaction As Boolean
```

Establishes a temporary exclusive access mode for doing a series of commands in a transaction.

Returns True for success, False for failure.

### SCard.CheckStatus

`Chilkat 11.7.0 · b4x · SCard · CheckStatus · method · since 9.50.87`

```visual-basic
CheckStatus As Boolean
```

Check the current status of the currently connected reader. Calling this method updates the ReaderStatus, ActiveProtocol, and CardAtr properties. If this method returns `False`, none of the properties are updated.

Returns True for success, False for failure.

### SCard.Connect

`Chilkat 11.7.0 · b4x · SCard · Connect · method · since 9.50.87`

```visual-basic
Connect (reader As String, shareMode As String, preferredProtocol As String) As Boolean
```

Establish a connection to a reader. The `reader` is the name of a reader returned from ListReaders. The `shareMode` can be `shared`, `exclusive`, or `direct`. The `preferredProtocol` can be `0` (valid only if the shareMode = `direct`), `T0`, `T1`, `raw`, or `no_preference`. (No preference is effectively T0 or T1.)

If successful, the state of this object instance is that it's connected to the reader.

Returns True for success, False for failure.

### SCard.Disconnect

`Chilkat 11.7.0 · b4x · SCard · Disconnect · method · since 9.50.87`

```visual-basic
Disconnect (disposition As String) As Boolean
```

Terminates a connection with a reader. The `disposition` can be one of the following values:

- `leave`: Do nothing.
- `reset`: Reset the card (warm reset).
- `unpower`: Power down the card (cold reset).
- `eject`: Eject the card.

Returns True for success, False for failure.

### SCard.EndTransaction

`Chilkat 11.7.0 · b4x · SCard · EndTransaction · method · since 9.50.87`

```visual-basic
EndTransaction (disposition As String) As Boolean
```

Ends a previously begun transaction. The `disposition` is the action to be taken on the reader, and can be `leave` which is to do nothing, `reset`, `unpower`, or `eject`.

Returns True for success, False for failure.

### SCard.EstablishContext

`Chilkat 11.7.0 · b4x · SCard · EstablishContext · method · since 9.5.0.87`

```visual-basic
EstablishContext (scope As String) As Boolean
```

Creates an Application Context to the PC/SC Resource Manager. This must be the first WinSCard function called in a PC/SC application. The `scope` can be `user` or `system`. After calling, this object will have context and all other methods will use the established context. The `Context` property will hold the value `user` or `system` if context was established, or will be empty if no context was established.

Returns True for success, False for failure.

### SCard.FindSmartcards

`Chilkat 11.7.0 · b4x · SCard · FindSmartcards · method · since 9.50.87`

```visual-basic
FindSmartcards (json As ChilkatJsonObject) As Boolean
```

Returns JSON containing information about the smartcards currently inserted into readers.

Returns True for success, False for failure.

### SCard.GetAttrib

`Chilkat 11.7.0 · b4x · SCard · GetAttrib · method · since 9.50.87`

```visual-basic
GetAttrib (attr As String, bd As ChilkatBinData) As Boolean
```

Get an attribute from the IFD Handler (reader driver).

The `attr` can be one of the following:

- `ASYNC_PROTOCOL_TYPES`
- `ATR_STRING`
- `CHANNEL_ID`
- `CHARACTERISTICS`
- `CURRENT_BWT`
- `CURRENT_CLK`
- `CURRENT_CWT`
- `CURRENT_D`
- `CURRENT_EBC_ENCODING`
- `CURRENT_F`
- `CURRENT_IFSC`
- `CURRENT_IFSD`
- `CURRENT_IO_STATE`
- `CURRENT_N`
- `CURRENT_PROTOCOL_TYPE`
- `CURRENT_W`
- `DEFAULT_CLK`
- `DEFAULT_DATA_RATE`
- `DEVICE_FRIENDLY_NAME`
- `DEVICE_IN_USE`
- `DEVICE_SYSTEM_NAME`
- `DEVICE_UNIT`
- `ESC_AUTHREQUEST`
- `ESC_CANCEL`
- `ESC_RESET`
- `EXTENDED_BWT`
- `ICC_INTERFACE_STATUS`
- `ICC_PRESENCE`
- `ICC_TYPE_PER_ATR`
- `MAX_CLK`
- `MAX_DATA_RATE`
- `MAX_IFSD`
- `MAXINPUT`
- `POWER_MGMT_SUPPORT`
- `SUPRESS_T1_IFS_REQUEST`
- `SYNC_PROTOCOL_TYPES`
- `USER_AUTH_INPUT_DEVICE`
- `USER_TO_CARD_AUTH_DEVICE`
- `VENDOR_IFD_SERIAL_NO`
- `VENDOR_IFD_TYPE`
- `VENDOR_IFD_VERSION`
- `VENDOR_NAME`

The attribute data is returned in `bd`.

Returns True for success, False for failure.

### SCard.GetAttribStr

`Chilkat 11.7.0 · b4x · SCard · GetAttribStr · method · since 9.50.87`

```visual-basic
GetAttribStr (attr As String) As String
```

Get a string typed attribute from the IFD Handler (reader driver).

The `attr` can be one of the following, but should be limited to the particular attributes that return string values.

- `ASYNC_PROTOCOL_TYPES`
- `ATR_STRING`
- `CHANNEL_ID`
- `CHARACTERISTICS`
- `CURRENT_BWT`
- `CURRENT_CLK`
- `CURRENT_CWT`
- `CURRENT_D`
- `CURRENT_EBC_ENCODING`
- `CURRENT_F`
- `CURRENT_IFSC`
- `CURRENT_IFSD`
- `CURRENT_IO_STATE`
- `CURRENT_N`
- `CURRENT_PROTOCOL_TYPE`
- `CURRENT_W`
- `DEFAULT_CLK`
- `DEFAULT_DATA_RATE`
- `DEVICE_FRIENDLY_NAME`
- `DEVICE_IN_USE`
- `DEVICE_SYSTEM_NAME`
- `DEVICE_UNIT`
- `ESC_AUTHREQUEST`
- `ESC_CANCEL`
- `ESC_RESET`
- `EXTENDED_BWT`
- `ICC_INTERFACE_STATUS`
- `ICC_PRESENCE`
- `ICC_TYPE_PER_ATR`
- `MAX_CLK`
- `MAX_DATA_RATE`
- `MAX_IFSD`
- `MAXINPUT`
- `POWER_MGMT_SUPPORT`
- `SUPRESS_T1_IFS_REQUEST`
- `SYNC_PROTOCOL_TYPES`
- `USER_AUTH_INPUT_DEVICE`
- `USER_TO_CARD_AUTH_DEVICE`
- `VENDOR_IFD_SERIAL_NO`
- `VENDOR_IFD_TYPE`
- `VENDOR_IFD_VERSION`
- `VENDOR_NAME`

Returns `Null` on failure

### SCard.GetAttribUint

`Chilkat 11.7.0 · b4x · SCard · GetAttribUint · method · since 9.50.87`

```visual-basic
GetAttribUint (attr As String) As Long
```

Get an unsigned integer typed attribute from the IFD Handler (reader driver).

The `attr` can be one of the following, but should be limited to the particular attributes that return unsigned integer values.

- `ASYNC_PROTOCOL_TYPES`
- `ATR_STRING`
- `CHANNEL_ID`
- `CHARACTERISTICS`
- `CURRENT_BWT`
- `CURRENT_CLK`
- `CURRENT_CWT`
- `CURRENT_D`
- `CURRENT_EBC_ENCODING`
- `CURRENT_F`
- `CURRENT_IFSC`
- `CURRENT_IFSD`
- `CURRENT_IO_STATE`
- `CURRENT_N`
- `CURRENT_PROTOCOL_TYPE`
- `CURRENT_W`
- `DEFAULT_CLK`
- `DEFAULT_DATA_RATE`
- `DEVICE_FRIENDLY_NAME`
- `DEVICE_IN_USE`
- `DEVICE_SYSTEM_NAME`
- `DEVICE_UNIT`
- `ESC_AUTHREQUEST`
- `ESC_CANCEL`
- `ESC_RESET`
- `EXTENDED_BWT`
- `ICC_INTERFACE_STATUS`
- `ICC_PRESENCE`
- `ICC_TYPE_PER_ATR`
- `MAX_CLK`
- `MAX_DATA_RATE`
- `MAX_IFSD`
- `MAXINPUT`
- `POWER_MGMT_SUPPORT`
- `SUPRESS_T1_IFS_REQUEST`
- `SYNC_PROTOCOL_TYPES`
- `USER_AUTH_INPUT_DEVICE`
- `USER_TO_CARD_AUTH_DEVICE`
- `VENDOR_IFD_SERIAL_NO`
- `VENDOR_IFD_TYPE`
- `VENDOR_IFD_VERSION`
- `VENDOR_NAME`

Returns 0xFFFFFFFF on failure.

### SCard.GetStatusChange

`Chilkat 11.7.0 · b4x · SCard · GetStatusChange · method · since 9.50.87`

```visual-basic
GetStatusChange (maxWaitMs As Int, stReaderNames As ChilkatStringTable, json As ChilkatJsonObject) As Boolean
```

Blocks execution until the current availability of the cards in a specific set of readers changes.

This function receives a list of reader names in `stReaderNames`. It then blocks waiting for a change in state to occur for a maximum blocking time of `maxWaitMs` (in milliseconds) or forever if 0 is used.

Information about the current reader states and which reader(s) changed is returned in `json`. See the example below for more information.

To wait for a reader event (reader added or removed) you may use the special reader name `\\?PnP?\Notification`.

To cancel the ongoing call, call Cancel().

The `stReaderNames` contains the reader names to check. The `json` is empty on input, and if the call returns success contains information about the state (after the event change) of each reader.

Returns True for success, False for failure.

### SCard.GetStatusChangeCancel

`Chilkat 11.7.0 · b4x · SCard · GetStatusChangeCancel · method · since 9.50.87`

```visual-basic
GetStatusChangeCancel As Boolean
```

Cancels an ongoing GetStatusChange method call. This would be called from a separate thread in your application if GetStatusChange was called synchronously.

Returns True for success, False for failure.

### SCard.ListReaderGroups

`Chilkat 11.7.0 · b4x · SCard · ListReaderGroups · method · since 9.50.87`

```visual-basic
ListReaderGroups (readerGroups As ChilkatStringTable) As Boolean
```

Returns a list of currently available reader groups on the system. The reader groups are returned in `readerGroups`.

Returns True for success, False for failure.

### SCard.ListReaders

`Chilkat 11.7.0 · b4x · SCard · ListReaders · method · since 9.50.87`

```visual-basic
ListReaders (st As ChilkatStringTable) As Boolean
```

Returns a list of currently available readers on the system.

Returns True for success, False for failure.

### SCard.Reconnect

`Chilkat 11.7.0 · b4x · SCard · Reconnect · method · since 9.50.87`

```visual-basic
Reconnect (shareMode As String, preferredProtocol As String, action As String) As Boolean
```

Reestablishes a connection to a reader that was previously connected to using Connect().

In a multi application environment it is possible for an application to reset the card in shared mode. When this occurs any other application trying to access certain commands will be returned the value SCARD_W_RESET_CARD. When this occurs Reconnect() must be called in order to acknowledge that the card was reset and allow it to change its state accordingly.

The `shareMode` can be `shared`, `exclusive`, or `direct`. The `preferredProtocol` can be `0` (valid only if the shareMode = `direct`), `T0`, `T1`, `raw`, or `no_preference`. (No preference is effectively T0 or T1.) The `action` is the desired action taken on the card/reader. It can be `leave`, `reset`, `unpower`, or `eject`.

If successful, the state of this object instance is that it's connected to the reader.

Returns True for success, False for failure.

### SCard.ReleaseContext

`Chilkat 11.7.0 · b4x · SCard · ReleaseContext · method · since 9.50.87`

```visual-basic
ReleaseContext As Boolean
```

Destroys a communication context to the PC/SC Resource Manager. This must be the last function called in a PC/SC application.

Returns True for success, False for failure.

### SCard.SendControl

`Chilkat 11.7.0 · b4x · SCard · SendControl · method · since 9.50.87`

```visual-basic
SendControl (controlCode As Long, bdSend As ChilkatBinData, bdRecv As ChilkatBinData) As Boolean
```

Sends a command directly to the IFD Handler (reader driver) to be processed by the reader.

This is useful for creating client side reader drivers for functions like PIN pads, biometrics, or other extensions to the normal smart card reader that are not normally handled by PC/SC.

The command data is sent in `bdSend`. The response is written to `bdRecv`.

Returns True for success, False for failure.

### SCard.SendControlHex

`Chilkat 11.7.0 · b4x · SCard · SendControlHex · method · since 9.50.87`

```visual-basic
SendControlHex (controlCode As Long, sendData As String, bdRecv As ChilkatBinData) As Boolean
```

Sends a command directly to the IFD Handler (reader driver) to be processed by the reader.

This is useful for creating client side reader drivers for functions like PIN pads, biometrics, or other extensions to the normal smart card reader that are not normally handled by PC/SC.

The command data is provided as a hex string in `sendData`. The response is written to `bdRecv`.

Returns True for success, False for failure.

### SCard.Transmit

`Chilkat 11.7.0 · b4x · SCard · Transmit · method · since 9.50.87`

```visual-basic
Transmit (protocolName As String, bdSend As ChilkatBinData, bdRecv As ChilkatBinData, maxRecvLen As Int) As Boolean
```

Sends an APDU to the smart card contained in the currently connected reader. The `protocolName` can be `T0`, `T1`, or `raw`. The APDU to be sent is contained in `bdSend`. The response from the card is contained in `bdRecv`. The `maxRecvLen` is the maximum response size (in bytes) willing to be accepted.

Returns True for success, False for failure.

### SCard.TransmitHex

`Chilkat 11.7.0 · b4x · SCard · TransmitHex · method · since 9.50.87`

```visual-basic
TransmitHex (protocolName As String, apduHex As String, bdRecv As ChilkatBinData, maxRecvLen As Int) As Boolean
```

Sends an APDU to the smart card contained in the currently connected reader. The `protocolName` can be `T0`, `T1`, or `raw`. The APDU (in hexadecimal) to be sent is passed in `apduHex`. The response from the card is contained in `bdRecv`. The `maxRecvLen` is the maximum response size (in bytes) willing to be accepted.

Returns True for success, False for failure.

## Events and callbacks

All Chilkat methods are synchronous: the call returns when the work is done. During a call, ChilkatSCard raises three events so your application can show progress and offer a way out. The event-name prefix is the string passed to `Initialize`:

```visual-basic
scard.Initialize("evt")     ' event Subs are named evt_AbortCheck, evt_PercentDone, evt_ProgressInfo
scard.HeartbeatMs = 250     ' raise evt_AbortCheck 4 times per second during Chilkat calls
```

`AbortCheck` fires at regular intervals controlled by the `HeartbeatMs` property (0, the default, disables it); `PercentDone` fires when an operation's completion percentage is known; `ProgressInfo` delivers named progress values. Returning `True` from an `AbortCheck` or `PercentDone` Sub aborts the running method. Implement only the Subs you need — events are skipped entirely when no matching Sub exists.

If a Chilkat call runs on a separate thread (e.g. via the Threading library), its events are automatically queued to the main thread. Events raised that way cannot abort by return value; set the object's `AbortCurrent` property to `True` instead.

### SCard.AbortCheck (event)

`Chilkat 11.7.0 · b4x · SCard · AbortCheck · event`

```visual-basic
' evt = the EventName passed to Initialize

' Return True to abort the Chilkat method in progress.

Sub evt_AbortCheck As Boolean
```

Enables a method call to be aborted by triggering the AbortCheck event at intervals defined by the `HeartbeatMs` property. If HeartbeatMs is set to its default value of 0, no events will occur. For instance, set HeartbeatMs to 200 to trigger 5 AbortCheck events per second.

**Example** (object initialized with `scard.Initialize("evt")`):

```visual-basic
scard.HeartbeatMs = 250   ' fire evt_AbortCheck 4 times per second

Sub evt_AbortCheck As Boolean
    ' Called every HeartbeatMs milliseconds while a Chilkat method is running.
    Return False   ' Return True to abort the method in progress
End Sub
```

### SCard.PercentDone (event)

`Chilkat 11.7.0 · b4x · SCard · PercentDone · event`

```visual-basic
' evt = the EventName passed to Initialize

' Return True to abort the Chilkat method in progress.

Sub evt_PercentDone (PctDone As Int) As Boolean
```

This provides the percentage completion for any method involving network communications or time-consuming processing, assuming the progress can be measured as a percentage. This event is triggered only when it's possible and logical to express the operation's progress as a percentage. The `pctDone` argument will range from 1 to 100. For methods that finish quickly, the number of PercentDone callbacks may vary, but the final callback will have `pctDone` equal to 100. For longer operations, callbacks will not exceed one per percentage point (e.g., 1, 2, 3, ..., 98, 99, 100).

The PercentDone callback also acts as an `AbortCheck` event. For fast methods where PercentDone fires, an AbortCheck event may not trigger since the PercentDone callback already provides an opportunity to abort. For longer operations, where time between PercentDone callbacks is extended, AbortCheck callbacks enable more responsive operation termination.

To abort the operation, set the `abort` output argument to `True`. This will cause the method to terminate and return a failure status or corresponding failure value.

**Example** (object initialized with `scard.Initialize("evt")`):

```visual-basic
Sub evt_PercentDone (PctDone As Int) As Boolean
    ' PctDone ranges from 1 to 100.
    Log("Percent done: " & PctDone)
    Return False   ' Return True to abort the method in progress
End Sub
```

### SCard.ProgressInfo (event)

`Chilkat 11.7.0 · b4x · SCard · ProgressInfo · event`

```visual-basic
' evt = the EventName passed to Initialize

Sub evt_ProgressInfo (Name As String, Value As String)
```

This event callback provides `tag name`/value pairs that detail what occurs during a method call. To discover existing tag names, create code to handle the event, emit the pairs, and review them. Most tag names are self-explanatory.

Note: Some Chilkat methods don't fire any ProgressInfo events.

**Example** (object initialized with `scard.Initialize("evt")`):

```visual-basic
Sub evt_ProgressInfo (Name As String, Value As String)
    Log(Name & ": " & Value)
End Sub
```

## Related classes

[`BinData`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/b4x/classes/BinData.md), [`JsonObject`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/b4x/classes/JsonObject.md), [`StringTable`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/b4x/classes/StringTable.md)

