Skip to content
GBG Documents & Biometrics Documentation

SLibEx library

The SLibEx library extends the function set introduced in the SLibEx library of the ScanW wrapper library.

The library exports additional methods to control the scanner functionality. These methods include:

The scanner library (and all other AcuFill SDK libraries) can serve a single application at a time. If you wish to run another application (that uses the AcuFill SDK), you must first unload the AcuFill SDK from the memory using this function. If you fail to do so, you could run into a situation where both applications will attempt to access the scanner (and other AcuFill SDK resources), which may affect or suspend the application.

Use this function to unload the scanner driver from the memory (hence, to reverse the operation of the InitLibrary function) before initializing the AcuFill SDK from the other application.

Note: See the InitLibrary function in the ScanW.pdf document.

Syntax

UnInit () As Long

Parameters

None

Return Values

Value Description
SLIB_UNLOAD_FAILED_BAD_PARENT Can’t unload the driver; in use by another application
SLIB_NOT_INITILIZED Can’t unload driver; driver not found in memory
SLIB_ERR_NONE Library unloaded successfully

This function initializes the scanner library, and, if successful, grants the calling application the ownership to the AcuFill SDK functionality. After the AcuFill SDK ownership is established, the function attempts to load the scanner driver and communicate to the scanner (if connected). If the application tries to call this function while another application is already using the AcuFill SDK (owns the AcuFill SDK), the function will return:

SLIB_LIBRARY_ALREADY_ USED_BY_OTHER_APP

as only one application may control the AcuFill SDK at a time. In such a case, the user must terminate the other application execution before attempting to initialize this library again. The application may retrieve the current AcuFill SDK owner information from the OwnerId and OwnerName properties in the SLibEx library.

The application can assume that it gained ownership on the AcuFill SDK only if the returned value is either:

  • LICENSE_VALID
  • SLIB_LIBRARY_ALREADY_INITIALIZED
  • SLIB_ERR_SCANNER_NOT_FOUND
  • SLIB_ERR_DRIVER_NOT_FOUND

If another value is returned, you will not be able to use the AcuFill SDK until you have fixed the problem.

If the scanner is not attached to the PC while calling this function, the application will be able to load the scanner by reading the IsScannerValid property. See the ScanW Library document for more information.

Note: This function extends the functionality of the InitLibrary function (described in ScanW.pdf) and may be used instead.

Note: The OwnerId must be a number over 100 (range 0-100 is reserved for AcuFill applications).

Syntax

InitEx (license As String, OwnerId As Interger, OwnerName As String) As Long

Parameters

Parameter Description
[in] license A 16 character AcuFill SDK license key string
[in] OwnweId A unique number that identifies the application that uses the AcuFill SDK on the local machine. The number must be in the range >100 as the value range 0-100 is reserved.
[in] OwnerName A string that contains the name of the application that is using the AcuFill SDK

Return Values

Value Description
LICENSE_VALID Library initialized successfully and is ready to use
LICENSE_INVALID Library failed to initialize because the license is invalid; all scanner operations disabled
LICENSE_EXPIRED Library failed to initialize because the license has expired; all scanner operations disabled
LICENSE_DOES_NOT_MATCH_LIBRARY Library failed to initialize because the license is invalid for this library; all library operations disabled
SLIB_ERR_SCANNER_NOT_FOUND Library initialized successfully but the scanner was not found
SLIB_ERR_DRIVER_NOT_FOUND Library initialized successfully but the driver was not found
SLIB_LIBRARY_ALREADY_INITIALIZED Library already initialized successfully by a previous call to InitLibraryEx; call ignored
SLIB_LIBRARY_ALREADY_ USED_BY_OTHER_APP Function failed to initialize; library already loaded and owned by another application

Uninitializes the scanner library. If successful, it releases the library from the current owner application and unloads the scanner driver from the memory.

Syntax

InitEx (OwnerId As Interger) As Long

Parameters

Parameter Description
[in] OwnweId A unique number that identifies the application

Return Values

Value Description
SLIB_ERR_NONE The SLib library was uninitialized successfully and the scanner driver was unloaded from the memory
SLIB_NOT_INITILIZED The function failed since the library is not in initialized status
SLIB_UNLOAD_FAILED_BAD_PARENT The function failed because the parameter OwnerId is not the value of the current library owner

Returns the current application name that initialized the AcuFill SDK using InitExfunction

Syntax

OwnerData (data As String)

Parameters

Parameter Description
[in] data Null-terminated string that contains the owner application name

Return Values

Application name

Stops and closes the SnapServer service that is used for the SnapShell camera.

Note: Call this function only after all the commands are done to close the application. This is the last function you should call when closing the application.

Syntax

KillSnapServer ()

Parameters

None

Return Values

None

Retrieves the total number of the connected SnapShell cameras

Syntax

get_TotalConnecetedScanners ()

Parameters

None

Return Values

The number of all connected SnapShell cameras

Retrieves the total number of the connected SnapShell cameras

Syntax

AssignScanner (ScannerIndex As Integer)

Parameters

Parameter Description
[in] Use -1 to get the USB port number of the next SnapShell camera

Return Values

The number of all connected SnapShell cameras.

Use a loop to call this function to release each SnapShell device or use the KillSnapServerfunction to release all the SnapShell devices at once.

Syntax

ReleaseScanner (ScannerIndex As Integer)

Parameters

Parameter Description
[in] Use -1 to release all SnapShell cameras

Return Values

None

Sets the active SnapShell device to a specific USB port

Syntax

SetCurrentScannerIndex (ScannerIndex As Integer)

Parameters

Parameter Description
[in] SnapShell device index as returned by the AssignScannerfunction

Return Values

None

Gets the active SnapShell device USB port

Syntax

GetCurrentScannerIndex ()

Parameters

None

Return Values

Returns the active USB port number of the current active SnapShell device

Detects and gets the first TWAIN scanner that connects to your system

  • If this function returns SLIB_ERR_NO_NEXT_VALUE, then no more TWAIN scanners have been detected.
  • If the return value is SLIB_TRUE, then there are more TWAIN scanners found and you can call the GetNextTwainSourcefunction to get the entire TWAIN scanners list.

Syntax

GetFirstTwainSource (ScannerName As String)

Parameters

Parameter Description
[In-out] ScannerName Gets the first TWAIN scanner name that is found

Return Values

Value Description
SLIB_TRUE Successfully completed
SLIB_FALSE Function failed to find scanner
SLIB_ERR_NO_NEXT_VALUE No more TWAIN scanners found
SLIB_ERR_NO_TWAIN_INSTALLED No TWAIN devices found

Detects and gets the next TWAIN scanner that connects to your system

  • If this function returns SLIB_ERR_NO_NEXT_VALUE, then no more TWAIN scanners have been detected.
  • If the return value is SLIB_TRUE, then there are more TWAIN scanners found and you can call the GetNextTwainSource function again to get the entire TWAIN scanners list.

Syntax

GetNextTwainSource (ScannerName As String)

Parameters

Parameter Description
[In-out] ScannerName Gets the next TWAIN scanner name that is found

Return Values

Value Description
SLIB_TRUE Successfully completed
SLIB_ERR_NO_NEXT_VALUE No more TWAIN scanners found

Gets the current TWAIN scanner that is connected to your system

Syntax

GetTwainScanner (ScannerName As String)

Parameters

Parameter Description
[In-out] ScannerName Gets the current connected TWAIN scanner name that is found

Return Values

Value Description
SLIB_TRUE Successfully completed
SLIB_ERR_NO_NEXT_VALUE No more TWAIN scanners found

Sets the current TWAIN scanner that is connected to your system

Note: Use this function before you initialize the library.

Syntax

SetTwainScanner (ScannerName As String)

Parameters

Parameter Description
[In] ScannerName String that contains the scanner name

Return Values

Value Description
SLIB_TRUE Successfully completed
SLIB_FALSE Failed to find a scanner

Calibrates the scanner using the calibration card (similar to the CalibrateScanner function in the ScanW.pdf) but this function will display the calibration progress bar dialog. The calibration results are stored in a file inside the windows directory. The operation result can be tested for good completion by reading LastErrorStatus property.

Syntax

CalibrateScannerEx ()

Return Values

Value Description
SLIB_TRUE Operation succeeded
SLIB_FALSE Operation failed (no calibration card was found)
SLIB_ERR_SCANNER_BUSSY Scanner still busy executing the previous scanner command
LICENSE_INVALID Library not initialized with proper license
SLIB_ERR_SCANNER_NOT_FOUND No attached scanner found
SLIB_ERR_INVALID_SCANNER Attached scanner invalid

Returns the serial number of the SnapShell scanner. (If the AcuFill SDK is connected to a SnapShell scanner)

Syntax

int GetSnapSerial (out string SSnapSerial)

Parameters

Parameter Description
pSerial A buffer to contain the serial number
nBufLen Length of the buffer that contains the number. Note: If the size of nBufLen is smaller than the length of the string to be returned, then nothing is copied to pSerial.

Return Values

Value Description
SLIB_TRUE Successfully completed
SLIB_FALSE Function failed to find a scanner

Sets the mode of external trigger

While in external trigger mode and working with a SnapShell scanner, the scanning operation will not be finished until the SetExternalTriggerfunction is called. (The light on the scanner will not turn green again). Returns none zero if successful.

Syntax

int SetExternalTriggerMode (int bVal);

Parameters

Parameter Description
int bVal 0 – Cancel trigger mode | 1 – Set trigger mode

Return Values

Value Description
SLIB_TRUE Successfully completed
SLIB_FALSE Function failed to find a scanner

Called to finish the scanning process, after ScanBmpFile/ScanBmpFileEx, when in external trigger mode. A successful call will finish the scanning process and turn the scanner light back to green. See the ScanW Library document for more information.

Syntax

int SetExternalTrigger();

Initiates a “fake” scan on the SnapShell scanner when in external trigger mode. A call will turn the scanner light to blue, until another call to SetExternalTriggeris made.

Syntax

int SetExternalOperation();

The following are SlibEx Library properties:

Returns or gets the Calibration Threshold value. This value will affect the Is Need Calibration function. (read/write)

Return Values

Value: 1 - 100, where 1 is the most sensitive and 100 is the least sensitive.

Returns/Gets the Duplex value (read/write) Activates the double-side scan when using ScanShell 3000D/ScanShell 800DX/ScanShell 800DXN scanners.

Returns or gets the InOutScan value (read/write)

Setting this value causes the ScanShell 3000D/ScanShell 800DX/ScanShell 800DXN to eject the scanned document in an opposite direction to the scan feed direction. This option is used to scan documents that can’t be scanned in a feed-through manner such as passports.

Sets the DefaultScanner value (Write)

Setting this value will set the AcuFill SDK to load faster because the SLib will try to initialize the scanner type that has been set in this value first.

Sets the UseFixedModel value (Write)

Setting this value will set the AcuFill SDK to work only with the given scanner type.

Sets the SetCenteredImage value (Write)

Specifies whether to set the alignment of the captured image to be centered.

Sets the remote IP address, port number and the remote scanner model (Write)

Enables the usage of a remote IP scanner on a different machine. The remote machine should have IpScan installed and running. After the client program is running, you can setup the port it is listening to (from the tray icon choose “configuration”“, if a file named IpScan.ini exists in the same folder as the .exe file then the port number will be stored in this file) and use SetRemoteIP, before initializing the library.

If the remote IP address parameter is USE_REMOTE_DESKTOP, then the AcuFill SDK will use the IP address of the remote desktop client (If a remote desktop session is active).

Used to test if the scanner connected to IpScan is valid. Returns the scanner type connected to IpScan or -1 when the scanner is not connected (read-only)

Note: This function does not test the status of the communication with IpScan, for that use IsScannerValid(). See the ScanW Library document for more information.

Returns the version of the remote IpScan software or -1 if not connected (read-only)

Scans an image file without waiting for the image to be transferred back to ScanW (IpScan only)

Return Values

Value Description
ScanBmpFileAsync Returns immediately when the scan is finished. You can call this function again before the file arrives to the calling machine
nDataPortNumber Specifies a port number on which the data will be transferred or -1 if you want to use the same port that was used for opening the connection
nThumbImageResolution If not set to -1, IpScan will send a small resolution image before the full size image that can be used for display
nThumbImageJpgQuality Sets the JpgQuality for the thumb

Returns the number of the first job in the queue or -1 if there are no jobs in the queue (read-only)

Returns the number of the next job in the queue or -1 if there are no jobs in the queue (read-only)

Returns the status of the supplied job number (read/write)

Return Values

Value Description
0 JOB_PENDING
1 JOB_DONE
2 JOB_THUMB_READY
3 JOB_NOT_FOUND
4 JOB_TIMEOUT
5 JOB_FAILED

If the status is JOB_DONE, JOB_TIMEOUT, or JOB_FAILED, it will be automatically be deleted from the job list after this call.

Returns the number of GBG devices connected to the machine or to the remote machine (read-only)

Copies the name of the GBG device connected to the machine or to the remote machine (read-only)

Parameters

Parameter Description
nIndex The index of the device
pStr Pointer to a null-terminated string that will contain the device name
nBufLen The size of the pStr buffer

Note: If the size of nBufLen is smaller than the length of the string to be returned, then nothing is copied to pStr.

Returns the serial number of the scanning device (read-only)

Note: This property is supported only for the SnapShell family of scanners. This property is set to 0 if the serial number can’t be read from the hardware.

Return Values

Value Description