Introduction

The basic LEADTOOLS TWAIN Class Library features are available in LEADTOOLS Raster, LEADTOOLS Raster Pro, LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite toolkits. The Fast Configuration capabilities are available only in the LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite toolkits. These capabilities are locked and must be unlocked using the key obtained from LEAD. For more information, refer to Unlocking Special LEAD Features. Its functions can be used to:

manage the TWAIN sources.

acquire pages from a specified source.

handle different TWAIN sources, like scanners, barcode readers, and digital cameras.

Executable demos are included in all LEADTOOLS products. The executable demos provide a quick and easy way to evaluate features and performance.

The toolkit comes in WIN32 editions so that it can support development of software applications for any of the following environments:

Windows 95 Family
Windows NT Family

Summary of All Supported Image File Formats

Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.


Example Programs

The following example program is in separate EXAMPLES subdirectories (such as C:\LEAD14\EXAMPLES\CLASSLIB). The executable files for these examples were compiled with Document/Medical capabilities. To get Document/Medical capabilities, you must buy a LEADTOOLS Document/Medical edition toolkit. Otherwise, if you recompile the examples, the resulting executable files will not have the Document/Medical capabilities.

Note:

You can run the example programs on your system by clicking the appropriate buttons in online help. If you try to run an example program that is not on your system, an error message will appear.

FastTwain | Demonstrates the LEADTOOLS FAST TWAIN features in one application.
Twain Demo | Demonstrates the LEADTOOLS TWAIN features in one application.
TwnConfig | Demonstrates the LEADTOOLS TWAIN Configuration features in one application.


Version History

Current version: | 14.5
Last update: | October 19, 2005

Changes from Version 14 to Version 14.5

Version 14


Changes from Version 14 to Version 14.5

Version 14.5 of LEADTOOLS TWAIN Class Library has changed from version 14 as follows:

LEADTOOLS TWAIN Class Library now supports JPEG compression.

LEADTOOLS TWAIN Class Library has added high-level functions let the user get and set specific capabilities, either singularly, or in groups.

The rest of this topic lists the new functions in version 14.5:

JPEG Compression Functions

LTwain::GetJPEGCompression

LTwain::SetJPEGCompression

High-Level Functions

LTwain::EnableDuplex

LTwain::GetAcquirePageOptions

LTwain::GetDuplexOptions

LTwain::GetImageBitsPerPixel

LTwain::GetImageEffects

LTwain::GetImageFrame

LTwain::GetImageUnit

LTwain::GetMaxXferCount

LTwain::GetResolution

LTwain::GetSupportedTransferMode

LTwain::GetTransferOptions

LTwain::SetAcquirePageOptions

LTwain::SetImageBitsPerPixel

LTwain::SetImageEffects

LTwain::SetImageFrame

LTwain::SetImageUnit

LTwain::SetMaxXferCount

LTwain::SetResolution

LTwain::SetRGBResponse

LTwain::SetTransferOptions

LTwain::ShowProgress


Version 14

Version 14 of LEADTOOLS TWAIN Class Library has been completely rewritten since version 13.

LEADTOOLS TWAIN Class Library now supports UNICODE.

The rest of this topic lists the new functions in version 14.

Acquiring Images

LTwain::Acquire

LTwain::AcquireList

Constructors / Destructors

LTwain::LTwain

LTwain::~LTwain

Creating a Twain Session

LTwain::InitSession

LTwain::EndSession

Working with Capabilities

LTwain::AddCapabilityToFile

LTwain::EnumCapabilities

LTwain::GetCapability

LTwain::GetCapabilityFromFile

LTwain::GetNumOfCapsInFile

LTwain::SetCapability

Working with Containers

LTwain::GetNumericContainerValue

LTwain::GetNumericContainerItemType

LTwain::GetNumericContainerINTValue

LTwain::GetNumericContainerUINTValue

LTwain::GetNumericContainerBOOLValue

LTwain::GetNumericContainerFIX32Value

LTwain::GetNumericContainerFRAMEValue

LTwain::GetNumericContainerSTRINGValue

LTwain::GetNumericContainerUNICODEValue

LTwain::CreateNumericContainerOneValue

LTwain::CreateNumericContainerRange

LTwain::CreateNumericContainerArray

LTwain::CreateNumericContainerEnum

LTwain::FreeContainer

LTwain::LockContainer

LTwain::UnlockContainer

Sources and Properties

LTwain::FreePropQueryStructure

LTwain::GetProperties

LTwain::GetSources

LTwain::IsAvailable

LTwain::SelectSource

LTwain::SetProperties

LTwain::QueryProperty

Template Functions

LTwain::CloseTemplateFile

LTwain::TemplateDlg

LTwain::OpenTemplateFile

Extended Image Information

LTwain::FreeExtendedImageInfoStructure

LTwain::GetExtendedImageInfo

Fast Twain (Scan Configurations)

LTwain::AcquireMulti

LTwain::FindFastConfig

LTwain::GetScanConfigs

LTwain::FreeScanConfig

Overridables

LTwain::AcquireCallBack

LTwain::AcquireCallBack

LTwain::BitmapCallBack

LTwain::CapabilityCallBack

LTwain::FindFastConfigCallBack

LTwain::SaveCapCallBack

LTwain::SaveErrorCallBack

LTwain::SetPropertyCallBack

LTwain::SourceInfoCallBack


Copyright notice

Copyright Notices

©Copyright LEAD Technologies, Inc. 1991-2005. ALL RIGHTS RESERVED

Portions of the PCDLIB32.DLL, PCDLIB.DLL, LFFPX7.DLL, LFKODAK.DLL, EKFPIXJPEG140.DLL, PDC_SDK.DLL, PROFIRE.DLL, DC120V154_32.DLL, LFDCR14N.DLL, DCSPROBACK.DLL, DCSPRO3SLR.DLL, LFDCS14N.DLL, and LFKDC14N.DLL files contain material that is ©Copyright Eastman Kodak Company, 1996-2001. This software is based in part on the work of the Independent JPEG Group.

Portions of the LFCRW14N.DLL, LTCMP14.DLL, CDSDK.reg, CDSDK.dll, CDRAPCLS.dll, czs_ui.dll, deimg.dll, deImg010.dll, deImg110.dll, deImg153.dll, deimg301.dll, deimg401.dll, deImg404.dll, deimg602.dll, Deimg603.dll, DeImgd60.dll, pscAdimg.dll, pscCllct.dll, pscCStUI.dll, pscDcd.dll, pscDevUI.dll, pscDvlp.dll, Pscl2STI.dll, pscll.dll, pscParse.dll, pscSetup.dll, psdkdll.dll, psdkReg.dll, psParse.dll. file contain material that is © Canon, Inc. 2002

Portions of the LFFPX7.DLL and LFKODAK.DLL files contain material that is ©Copyright Hewlett Packard, 1996.

Portions of the OCR/ICR/OMR Features and the help file for the OCR/ICR/OMR Features are ©Copyright Scansoft, Inc. 1995-2003. ALL RIGHTS RESERVED

Portions of the Barcode Modules contain material that is ©Copyright Axtel Inc., 1999.

Portions of the LEADTOOLS PDF Plug in and the LEADTOOLS Vector Imaging Pro are ©Copyright 1996, 2000 Artifex Software Inc. All rights reserved.

File filters for decoding MrSID ® and DjVu ® formats are provided under a license from Lizardtech, Inc.

The "FlashPix" format uses Microsoft's OLE structured storage.

Portions of the DICOM help files in Medical Imaging product line are reprinted with permission from the National Electrical Manufacturers Association ©Copyright 1998 by the National Electrical Manufacturers Association. All rights including translation into other languages, reserved under the Universal Copyright Convention, the Berne Convention or the Protection of Literacy and Artistic Works, and the International and Pan American Copyright Conventions.

Portions of LEADTOOLS Data Security Add On contain software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/), including cryptographic software written by Eric Young (eay@cryptsoft.com) and by Tim Hudson (tjh@cryptsoft.com). Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) All rights reserved. Copyright Tim Hudson 1995-1998 (tjh@cryptsoft.com) All rights reserved.

Portions of LEADTOOLS Data Security Add On contain software based on the MD5 Message Digest Algorithm developed by RSA Data Security, Inc.. Copyright (c) 1991-92 RSA Data Security, Inc. All Rights Reserved.

Portions hereof licensed under US patent 5,327,254 and foreign counterparts.

Portions of the LEADTOOLS ICC Profiles material is © Copyright 2004, International Color Consortium.

Trademarks

LEAD and LEADTOOLS are registered trademarks of LEAD Technologies, Inc.
Microsoft, Windows, Windows NT, Visual Basic, Visual FoxPro, and Microsoft Access are either trademarks or registered trademarks of the Microsoft Corporation.
OS/2® is a registered trademark of International Business Machines Corporation.

TextBridge®OCR is a registered trademark of Scansoft, Inc.

ISIS® is a registered trademark of Pixel Translations, Inc.

ScanAhead™ is a trademark of Pixel Translations, Inc.

FlashPix™ is a trademark of Eastman Kodak Company.

All other brand or product names used in this online help are trademarks of their respective holders.

Address and Contact Information

LEAD Technologies, Inc.
Suite 400,
1201 Greenwood Cliff,
Charlotte, NC 28204

(704) 332-5532
FAX: (704) 372-8161
Technical support: (704) 372-9681 or Support@Leadtools.com
Home page: http://www.leadtools.com


Programming with LEADTOOLS TWAIN Functions

Once the TWAIN driver is installed and configured to the system, the user is ready to begin programming with LEADTOOLS TWAIN. LEADTOOLS provides functions for:

Selecting and managing the available TWAIN source installed on the system.

Acquiring images from a selected TWAIN source.

Handling different TWAIN sources, like scanners, barcode readers, and digital cameras.

LEADTOOLS uses a TWAIN session handle to provide the means for acquiring pages from the TWAIN source. The TWAIN session handle is a communication session between LEADTOOLS TWAIN and a TWAIN driver installed on the system. This TWAIN handle is a pointer to an internal structure that contains all the necessary information for acquiring, getting and setting information, managing the TWAIN sources, and handling template files.

Getting Started

To begin using the available features in the LEADTOOLS TWAIN toolkit, the user should initialize a TWAIN session. For more information, refer to Initializing a TWAIN Session.

The user can now, select a specific TWAIN source from the sources installed on the system, or use the default TWAIN source. This must be done after the user has initialized a TWAIN session. For more information, refer to Managing the TWAIN Source.

Setting and Getting Capabilities Values

Each TWAIN source has a set of supported capabilities. The user may set these capabilities to some desired value before acquiring the image(s) or the user may elect to use the TWAIN source's default values for the capabilities. LEADTOOLS provides functions for working with capabilities in the following ways:

Enumerating the capabilities supported by the source and getting their values.

Setting or resetting defined values by the TWAIN source of a certain capability.

Getting capabilities values supported by the TWAIN source.

For more information, refer to Getting and Setting Capabilities.

Acquiring Images or Image Data

After the desired TWAIN source capabilities have been set, the user can start acquiring raster images and/or image data. Image data is related to the data acquired from a barcode, if the selected TWAIN source is the barcode reader.

For more information, refer to How to Acquire from the TWAIN Source.

Save Settings to Files

The user can save the capability settings, used when acquiring images, in a template file. These capability settings can then obtained from the template file and used to acquire images from the same TWAIN source later, instead of getting and setting the TWAIN capabilities each time. For more information, refer to Handling Template Files.

Freeing the TWAIN Session

When the handle to the TWAIN session is no longer needed, it should be freed. For more information, refer to Freeing the TWAIN Session.


Unlocking Special LEAD Features

LEAD offers a variety of features, such as Document support, Medical support, Vector support, etc., which are only available in certain toolkits and are locked. To use these features you must:

purchase a toolkit that supports the desired feature(s).

print the applicable runtime agreement from the help file. For information on the runtime agreements, go to Topic Selection and click on the LEAD Licensing button.

complete the Transmittal document and fax it and the runtime agreement to LEAD's Licensing Department at 704 – 372 – 3789. (To get a copy of the Transmittal document, you must contact LEAD.)

if prepaid licenses are desired, include the order form with payment information. You can fax this along with the Transmittal form and the runtime agreement. (To get a copy of the order form, you must contact LEAD.)

once we have received the signed agreement, we will send instructions for eliminating the license dialogs and the key(s) necessary for unlocking the appropriate features.

when you have received the instructions and the key(s) call the LSettings::UnlockSupport function with the appropriate key.

For example, if you have purchased the LEADTOOLS Document Imaging toolkit:

print the Document Imaging Agreement (or the Document Imaging with OCR Agreement if you have also purchased the LEADTOOLS OCR Module).

complete the Transmittal document and fax it and the Document Imaging Agreement (or the Document Imaging with OCR Agreement) to LEAD's Licensing Department.

if you want prepaid licenses, print a copy of the order form, fill it out and send the order form and payment information to LEAD.

once we have received the signed Document Imaging Agreement (or Document Imaging with OCR Agreement), we will send the instructions for eliminating the license dialogs and any necessary keys.

when you receive the instructions and the key(s), call LSettings::UnlockSupport (L_SUPPORT_DOCUMENT, "Document Key") to unlock the Document features. Please note that "Document Key" represents the actual key you will receive from LEAD. Also note that if you also purchased the LEADTOOLS OCR Module, the OCR features will have to be unlocked separately, using the appropriate key.

For information on products and the features available in each product, or for information on licensing, refer to Topic Selection.

To determine if a certain feature is locked, call the IsSupportLocked .


Initializing a TWAIN Session

To begin using the LEADTOOLS TWAIN toolkit, the user must initialize a Twain session. This is done by calling the LTwain::InitSession function. This session is required before you can perform any other Twain operations, so this function must be called before calling other LEADTOOLS TWAIN functions.

After establishing the TWAIN session, the user can now select the TWAIN source he or she wants to use for acquiring images. For more information on this, refer to Managing the TWAIN Source.


Managing the TWAIN Source

Once the user has established a handle to a TWAIN session, the TWAIN source to use for acquiring images should be selected. To determine the TWAIN sources available on the system, LEADTOOLS provides the LTwain::GetSources function. This function enumerates all available TWAIN sources and calls the LTwain::SourceInfoCallBack function for each TWAIN source found.

To select the TWAIN source to use for acquiring images, call the LTwain::SelectSource function.

Each TWAIN source has certain capabilities. The user may wish to alter these capability settings before acquiring images from the TWAIN source. For more information on this, refer to Getting and Setting Capabilities.

LEADTOOLS TWAIN toolkit also provides functions to manage the TWAIN sources installed on the system:

LTwain::SelectSource displays a dialog that lists all available TWAIN sources installed on the system. This dialog lets the user select the TWAIN source he or she wants to use.

LTwain::GetSources function is used to enumerate either all available TWAIN sources, or the currently selected TWAIN source, and retrieve the name of the source(s). The LTwain::SourceInfoCallBack function is called for each TWAIN source enumerated.


How to Acquire from the TWAIN Source

After the user has established a TWAIN session, selected a TWAIN source, and set the desired capabilities of the TWAIN source, he or she is ready to acquire images or image data from that source. LEADTOOLS provides the following functions for acquiring images and image data from a TWAIN source:

The LTwain::Acquire function acquires one or more images from a TWAIN source. If the user has overridden the LTwain::BitmapCallBack function, the function will receive each image acquired from the source. This allows the user to process each image as desired. If only one image is acquired, and the user does not supply a callback function, the pBitmap parameter of LTwain::Acquire is updated with the acquired image. Within the LTwain::BitmapCallBack function the user can call the LTwain::GetExtendedImageInfo to get extended image information that is included if the TWAIN source is a barcode reader or a digital camera. LTwain::FreeExtendedImageInfoStructure will free the TW_EXTIMAGEINFO structure that the LTwain::GetExtendedImageInfo function retrieves. For more information about TW_EXTIMAGEINFO, refer to the TWAIN 1.9 specification from the site "http://www.twain.org/".

The LTwain::AcquireList function acquires one or more images from the TWAIN source and stores them in the specified LEAD bitmap list.

The LTwain::AcquireMulti function acquires one or more images from a TWAIN source and saves the image(s) to one or more files. If the file format used does not support multi-page files, then the images will be saved to a series of files named by appending the image number to a base file name. If the file format used does support multi-page files, then the image(s) will be saved to one or more files based on the bMultiPageFile parameter. If this parameter is FALSE, then images will be saved to a series of files named by appending the image number to a base file name. If this parameter is TRUE, the image(s) will be saved to one multi-page file named using only the base file name.

The LTwain::AcquireMulti function takes an optional parameter a pointer to an LTwain::AcquireCallBack function. This callback function is called twice for each page scanned using the LTwain::AcquireMulti function. It is called the first time when the Twain source begins scanning the page. It is called the second time when the Twain source has finished scanning the page.

The functions listed above can acquire images in the following transfer modes:

Native | gets the bitmaps being scanned into the memory as a whole.
Memory Buffered | gets images from the source as strips of data. These strips can be merged to get the whole image.
File | gets the images from the source to a disk file.


Getting and Setting Capabilities

Each TWAIN source may support a number of capabilities. These capabilities dictate the behavior of the TWAIN source. Before acquiring images from the selected TWAIN source, the user may wish to examine and change the capability settings for that source.

LEADTOOLS provides both low-level and high-level functions for getting and setting capabilities. The low-level functions get and set capabilities individually. The high-level functions let the user get and set specific capabilities, either singularly, or in groups.

Low-Level:

To get information about the capabilities supported by the selected TWAIN source, call the LTwain::EnumCapabilities function. For each capability enumerated by LTwain::EnumCapabilities, this function will call the LTwain::CapabilityCallBack function. Within this callback function the user can process the capability information.

To get information on a specific capability (current, default, or all possible values) call LTwain::GetCapability. This function gets information about the capability specified in a TW_CAPABILITY structure. For more information about TW_CAPABILITY, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

To set a specific capability to a new value or to reset the value of a capability to the default value, call LTwain::SetCapability.

High-Level:

LTwain::GetProperties and LTwain::SetProperties allow the user to set and get a number of capabilities through the LTWAINPROPERTIES structure. If this structure does not have the capability needed to negotiate, the user may use the low-level functions to do so.

The LTwain::QueryProperty function lets the user get the available values for a specific capability from the selected source.

There are several transfer option capabilities that control the file name, compression, transfer mode, and file format. These can be obtained or set collectively using the LTwain::GetTransferOptions and the LTwain::SetTransferOptions functions.

In addition to the transfer options mentioned above, the transfer modes supported by the TWAIN source can be obtained by calling the LTwain::GetSupportedTransferMode function.

When transferring files from the TWAIN source there is a maximum number of files that can be transferred. To get the current value, call the LTwain::GetMaxXferCount function. To change that value, call the LTwain::SetMaxXferCount function.

There are many capabilities associated with various image characteristics, such as image resolution, image frame, image unit, bits per pixel, etc. The current values for these can be obtained using the following functions:

LTwain::GetResolution

LTwain::GetImageFrame

LTwain::GetImageUnit

LTwain::GetImageBitsPerPixel

To change the values of these capabilities, use the following functions:

LTwain::SetResolution

LTwain::SetImageFrame

LTwain::SetImageUnit

LTwain::SetImageBitsPerPixel

Image contrast, highlight and brightness capabilities can be set simultaneously by calling LTwain::SetImageEffects. To find out the current settings for contrast, highlight and brightness, call LTwain::GetImageEffects.

The RGB elements used by the TWAIN source can be set by calling the LTwain::SetRGBResponse function.

If the TWAIN source supports duplex scanning, a specific duplex mode can be enabled or disabled by calling LTwain::EnableDuplex. To get the current duplex mode and the enabled status of that mode, call LTwain::GetDuplexOptions.

The page size and orientation used during image acquisition can be set by calling LTwain::SetAcquirePageOptions. To get the current settings for these page options, call LTwain::GetAcquirePageOptions.

During the actual acquisition process, you can elect to have a progress indicator displayed. The LTwain::ShowProgress function lets you hide or display the progress indicator.

After setting the desired capabilities call LTwain::Acquire to scan the pages.

When working with TW_CAPABILITY structures it may be necessary to create a container associated with that structure. For more information on containers, refer to How to Work with the Containers.


How to Work with the Containers

When getting or setting capability information, it may be necessary to create a container for the associated TW_CAPABILITY structure. The structure of these containers depends on the type of information in the container. LEADTOOLS supports the following types of containers:

TW_ARRAY

TW_ENUMERATION

TW_ONEVALUE

TW_RANGE

For more information on these container types, refer to the TWAIN 1.9 Specification, available at www.twain.org.

For each type of container, LEAD provides a specific function:

LTwain::CreateNumericContainerArray, allocates the container of the TW_CAPABILITY structure to be of type TW_ARRAY and fills it with the specified data.

LTwain::CreateNumericContainerEnum, allocates the container of the TW_CAPABILITY structure to be of type TW_ENUMERATION and fills it with the specified data.

LTwain::CreateNumericContainerOneValue, allocates the container of the TW_CAPABILITY structure to be of type TW_ONEVALUE and fills it with the specified data.

LTwain::CreateNumericContainerRange, allocates the container of the TW_CAPABILITY structure to be of type TW_RANGE and fills it with the specified data.

The value in a container can be changed once the user has a pointer to the container. To change the value of a container, the user can call LTwain::LockContainer, make the desired changes to the container value(s), and then call LTwain::UnlockContainer. Alternately, the user can accomplish the same thing be calling the API GlobalLock and GlobalUnlock functions.

When the created container is no longer needed, it should be freed by calling LTwain::FreeContainer.

LEAD provides a number of functions for getting container values, based on the data type of the value. To get the data type of the value in a container, call LTwain::GetNumericContainerItemType. Once the type is known, the following functions can be used to get the container value(s) from the TW_CAPABILITY structure:

LTwain::GetNumericContainerINTValue

LTwain::GetNumericContainerUINTValue

LTwain::GetNumericContainerFIX32Value

LTwain::GetNumericContainerFRAMEValue

LTwain::GetNumericContainerSTRINGValue

LTwain::GetNumericContainerUNICODEValue

LTwain::GetNumericContainerBOOLValue

To get the available values for a specific TWAIN capability, call LTwain::QueryProperty. This function takes a pointer to a LTWAINPROPERTYQUERY structure, which will be updated with the available values for the capability.


Fast TWAIN (Scan Configurations)

The performance of a TWAIN scanner can vary based on its scan configuration. The TWAIN driver of your TWAIN scanner comes with one or more "default" scan configurations. In addition, the user may create one or more user-defined scan configurations. LEAD provides several functions to determine the best and fastest scan configuration available, thereby letting you use the best and fastest scan configuration for scanning images.

To determine the best and fastest scan configuration for your TWAIN scanner, call LTwain::FindFastConfig. This function will test either an array of user-defined scan configurations, or all the default scan configurations present for the TWAIN driver of the current TWAIN scanner, based on the values of the pInFastConfigs and the nInFastConfigsCount parameters. For each scan configuration that is tested, the LTwain::FindFastConfig function calls the LTwain::FindFastConfigCallBack function. This callback function receives the information for the scan configuration being tested. This lets you interact with the scan configuration information as needed.

Since the list of default scan configurations present for a specific TWAIN driver can be rather numerous, you can narrow the list you wish to test using the LTwain::GetScanConfigs function. This function gets default scan configurations based on the transfer mode, bits per pixel and number of buffers. Therefore, you can get a list of scan configurations for a specific transfer mode, pass this list of scan configurations to the LTwain::FindFastConfig function, and decrease the number of default scan configurations that must be tested.

Both the LTwain::FindFastConfig function and the LTwain::GetScanConfigs function allocate storage for an array of FASTCONFIG structures that contains scan configurations. This storage must be freed by calling LTwain::FreeScanConfig, when the array is no longer needed.

Once the best scan configuration has been determined, the scan configuration information can be passed to the LTwain::AcquireMulti function so the images will be acquired as fast as possible.


Handling Template Files

Template files are used to store capability information for a specific TWAIN source. That way, the next time that TWAIN source is used, the corresponding template file can provide information on the capabilities used previously.

LEADTOOLS provides the following functions for working with template files:

LTwain::TemplateDlg displays the scanning dialog provided by the manufacturer of the TWAIN source without actually acquiring the images. Instead it gets the values of all supported capabilities, which will be saved to the specified template file.

LTwain::OpenTemplateFile opens a template file for either reading or writing. When a template file is open for reading, the user can get capability information stored within the file. When a template file is opened for writing, capability information can be saved to that file.

LTwain::AddCapabilityToFile adds a certain capability to the file when the file is opened with write access.

LTwain::GetNumOfCapsInFile gets the number of capabilities stored in a template file.

LTwain::GetCapabilityFromFile gets the capability information by passing its index to the function.

LTwain::CloseTemplateFile closes the file and saves its contents if the file was opened with write access.

When a user acquires one or more images using the LTwain::Acquire function, the capability settings used for the TWAIN source can be saved in a template file. The next time the user wishes to use that TWAIN source he or she can open the template file saved previously, for read access, using LTwain::OpenTemplateFile. The LTwain::GetNumOfCapsInFile function will provide the number of capabilities stored in the template file. This information allows the user to loop through the stored capabilities using the LTwain::GetCapabilityFromFile function. As each capability is obtained, the user can set the capabilities for the TWAIN source using the LTwain::SetCapability function.


Freeing the TWAIN Session

When the TWAIN session is no longer needed, the user must free the session resources by calling LTwain::EndSession. At this point the TWAIN session becomes invalid. Before acquiring any more images from a TWAIN source, the user must establish a new TWAIN session by calling LTwain::InitSession.


Using JPEG Compression for a TWAIN Source

LEADTOOLS provides functionality to get and set JPEG compression for a TWAIN source. Use the LTwain::GetJPEGCompression function to obtain the current TWAIN JPEG compression settings by passing LTWAIN_GET_JPEG_COMPRESSION to the uFlag parameter. Similarly, obtain the default TWAIN JPEG compression settings by passing LTWAIN_GET_DEFAULT_JPEG_COMPRESSION to the uFlag parameter when calling the LTwain::GetJPEGCompression function.

To set JPEG compression for a TWAIN source, call the LTwain::SetJPEGCompression function and pass LTWAIN_SET_JPEG_COMPRESSION to the uFlag parameter. To restore the default TWAIN JPEG compression, call the LTwain::SetJPEGCompression function and pass LTWAIN_RESET_JPEG_COMPRESSION to the uFlag parameter.


Files To Be Included With Your Application

The installation procedure creates a directory tree for the LEADTOOLS files, and adds the demonstration programs and online help to your desktop. You specify the root directory during installation. The following subdirectory for the LEADTOOLS TWAIN features is created:

REDIST\

Redistributable LEADTOOLS TWAIN features files.

Note: | The LEADTOOLS TWAIN features are provided for evaluation purposes only. You may not copy or redistribute any of the following files without obtaining the proper license. In some cases, the license is included with your initial purchase of LEADTOOLS. In other cases, you must obtain a license from a third party or enter into a royalty agreement with LEAD to obtain the proper license. For these special licensing situations, see the notes below accompanying the specific file.
Note: | You may not distribute the header files with your application, and you may not provide software development capabilities in your application.

The following table summarizes the files you must include on your distribution diskettes to support the LEADTOOLS TWAIN features functions on a WIN32 system. (\REDIST\ subdirectory contains copies of these files.)

Please note that LTKRN and LTWVC are required for ALL Class Library applications. For more information on LTKRN, LTWVC, and other files for the Main Class Library, refer to Files To Be Included With Your Application.

Note: All Unicode versions of LEADTOOLS require Microsoft Unicode Layer for Windows (UNICOWS.DLL) in order to function on Windows 95/98/Me. You can obtain MSUL from: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/anch_mslu.asp.

Redistributables: | Explanation: | If you are using a standard release without Unicode, the files to use are: | If you are using a standard release with Unicode, the files to use are: | If you are using an evaluation release without Unicode, the files to use are: | If you are using an evaluation release with Unicode, the files to use are:
LTTWN | TWAIN support. LTTWN14n.DLL is the LEADTOOLS TWAIN Support DLL. | DLL: LTTWN14N.DLL Library: LTTWN_N.LIB | DLL: LTTWN14NU.DLL Library: LTTWN_NU.LIB | DLL: LTTWN14E.DLL Library: LTTWN_E.LIB | DLL: LTTWN14EU.DLL Library: LTTWN_EU.LIB


Installation Directory

The installation procedure creates a directory tree for the LEADTOOLS files, demonstration programs and online help. You specify the root directory during installation.

Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.

The following is a list of the subdirectories in the root directory:

BIN | Executable files for the demonstration programs.
HELP | Online help files.
EXAMPLES\CLASSLIB | One subdirectory for each example Class Library program.
EXAMPLES\RES | Resource files for the example programs.
INCLUDE | Header files, BAS files, and the ActiveX's MFC interface files for versions of Visual C++ earlier than 4.0.
LIB | Library files.
REDIST | Redistributable files. These are copies of the LEADTOOLS files and other files that you may need to distribute with your application. For exact information about required files, refer to Files To Be Included With Your Application.


Technical Support

As a registered user, free technical support is available. You must register your software to receive any technical support. Technical support is available 9 a.m. through 6 p.m. Eastern Standard Time. If you are calling by phone, please be at your computer. You can also contact us through the following methods:

Phone: | (704) 372-9681
E-mail: | support@leadtools.com
FAX: | (704) 372-8161
Home page: | http://www.leadtools.com
FTP: | ftp.leadtools.com

You can also contact LEAD by mail at:

LEAD Technologies, Inc.
Attn: Technical Support
Suite 400,
1201 Greenwood Cliff,
Charlotte, NC 28204

Before calling technical support, please look in the online documentation and the example programs for an answer to your question.


Class Library Function Groups

TWAIN Functionality

Capability Functions

Container Functions

Property Functions

Session Functions

Template File Functions

Callbacks

Extended Image Information Functions

Fast TWAIN (Scan Configuration) Functions

JPEG Compression Functions


TWAIN Functionality: Capability Functions

TWAIN Functionality:
Capability Functions

Low Level Functions:

LTwain::AddCapabilityToFile

LTwain::EnumCapabilities

LTwain::GetCapability

LTwain::GetCapabilityFromFile

LTwain::GetNumOfCapsInFile

LTwain::SetCapability

High Level Functions:

LTwain::EnableDuplex

LTwain::GetAcquirePageOptions

LTwain::GetDuplexOptions

LTwain::GetImageBitsPerPixel

LTwain::GetImageEffects

LTwain::GetImageFrame

LTwain::GetImageUnit

LTwain::GetMaxXferCount

LTwain::GetResolution

LTwain::GetSupportedTransferMode

LTwain::GetTransferOptions

LTwain::SetAcquirePageOptions

LTwain::SetImageBitsPerPixel

LTwain::SetImageEffects

LTwain::SetImageFrame

LTwain::SetImageUnit

LTwain::SetMaxXferCount

LTwain::SetResolution

LTwain::SetRGBResponse

LTwain::SetTransferOptions

LTwain::ShowProgress


TWAIN Functionality: Container Functions

TWAIN Functionality:
Container Functions

LTwain::CreateNumericContainerArray

LTwain::CreateNumericContainerEnum

LTwain::CreateNumericContainerOneValue

LTwain::CreateNumericContainerRange

LTwain::FreeContainer

LTwain::GetNumericContainerBOOLValue

LTwain::GetNumericContainerFIX32Value

LTwain::GetNumericContainerFRAMEValue

LTwain::GetNumericContainerINTValue

LTwain::GetNumericContainerSTRINGValue

LTwain::GetNumericContainerItemType

LTwain::GetNumericContainerUINTValue

LTwain::GetNumericContainerUNICODEValue

LTwain::GetNumericContainerValue

LTwain::LockContainer

LTwain::UnlockContainer


TWAIN Functionality: Property Functions

TWAIN Functionality:
Property Functions

LTwain::IsAvailable

LTwain::Acquire

LTwain::AcquireList

LTwain::AcquireMulti

LTwain::FreePropQueryStructure

LTwain::GetProperties

LTwain::GetSources

LTwain::SelectSource

LTwain::SetProperties

LTwain::QueryProperty

LTwain::AcquireCallBack


TWAIN Functionality: Session Functions

TWAIN Functionality:
Session Functions

LTwain::EndSession

LTwain::InitSession


TWAIN Functionality: Template File Functions

TWAIN Functionality:
Template File Functions

LTwain::CloseTemplateFile

LTwain::OpenTemplateFile

LTwain::TemplateDlg


TWAIN Functionality: Callbacks

TWAIN Functionality:
Callbacks

LTwain::AcquireCallBack

LTwain::BitmapCallBack

LTwain::CapabilityCallBack

LTwain::FindFastConfigCallBack

LTwain::SaveCapCallBack

LTwain::SaveErrorCallBack

LTwain::SetPropertyCallBack

LTwain::SourceInfoCallBack


TWAIN Functionality: Extended Image Information Functions

TWAIN Functionality:
Extended Image Information Functions

LTwain::FreeExtendedImageInfoStructure

LTwain::GetExtendedImageInfo


TWAIN Functionality: Fast TWAIN (Scan Configuration) Functions

TWAIN Functionality:
Fast TWAIN (Scan Configuration) Functions

LTwain::AcquireMulti

LTwain::FindFastConfig

LTwain::GetScanConfigs

LTwain::FreeScanConfig

LTwain::FindFastConfigCallBack


TWAIN Functionality: JPEG Compression Functions

TWAIN Functionality:
JPEG Compression Functions

LTwain::GetJPEGCompression

LTwain::SetJPEGCompression


Data Types

Basic Data Types and Keywords

LEADTOOLS Basic Data Types

Keywords Used in Declarations

TWAIN Data Types

APPLICATIONDATA

DATATRANSFER

FASTCONFIG

IMAGEEFFECTS

IMAGERESOLUTION

LTWAINNUMERICTYPE

LTWAINPROPERTIES

LTWAINPROPERTYQUERY

LTWAINSOURCE

LTWAINSOURCEINFO

HTWAINTEMPLATEFILE

TRANSFEROPTIONS

TWAIN_TRANSFER_MODES


LEADTOOLS Basic Data Types

LEADTOOLS has defined the following basic data types for portability:

Data Type | Definition and Usage
L_BITFIELD | Defined as L_UINT; used as a bit field.
L_BOOL | Defined as L_UINT; used as a boolean value.
L_CHAR | Defined as char; used as a signed 8-bit integer.
L_DOUBLE | Defined as double; used as a double precision floating point number.
L_FLOAT | Defined as float; used as a floating point number.
L_INT | Defined as int; used as a signed integer, 16-bits or larger.
L_INT16 | Defined as short; used as a signed 16-bit integer.
L_INT32 | Defined as long; used as a signed 32-bit integer.
L_UCHAR | Defined as unsigned char; used as an unsigned 8-bit integer.
L_UINT | Defined as unsigned; used as an unsigned integer, 16-bits or larger.
L_UINT16 | Defined as unsigned short; used as an unsigned 16-bit integer.
L_UINT32 | Defined as unsigned long; used as an unsigned 32-bit integer.
L_VOID | Defined as void; used as a void.
L_COMP | Defined as L_UINT; used as a handle to a computer
L_MEDIA | Defined as L_VOID L_FAR *; used as a void pointer
L_TCHAR | Defined as either char or TCHAR. If FOR_UNICODE is defined, then L_TCHAR will be defined as TCHAR.
L_HANDLE | Defined as L_VOID *; used as a void pointer.


Keywords Used in Declarations

LEADTOOLS uses the following keywords in declarations of functions, structures, and datatypes:

Keyword | Definition and Usage
L_FAR | Defined as nothing; used as a placeholder.
L_HUGE | Defined as nothing; used as a placeholder.
L_EXPORT | Defined as nothing; used as a placeholder.
L_PASCAL | Defined as nothing; used as a placeholder.
EXT_FUNCTION | Defined as WINAPI; used as an attribute for all toolkit functions.
pEXT_FUNCTION | Defined as EXT_FUNCTION L_FAR *; used as an attribute when defining pointers to toolkit functions.
EXT_CALLBACK | Defined as _cdecl L_FAR; used as an attribute for all toolkit callback functions.
pEXT_CALLBACK | Defined as EXT_CALLBACK L_FAR *; used as an attribute when defining pointers to toolkit callback functions.


APPLICATIONDATA

typedef struct _APPLICATIONDATA
{

L_UINT uStructSize;
HWND hWnd;
L_TCHAR zManufacturerName [256];
L_TCHAR zAppProductFamily [256];
L_TCHAR szVersionInfo [32];
L_TCHAR szAppName [256];
} APPLICATIONDATA, L_FAR * pAPPLICATIONDATA;

The APPLICATIONDATA structure provides information about an application data.

Member | Description
uStructSize | Size of the APPLICATIONDATA structure in bytes, for versioning. Use the sizeof() macro to calculate the value.
hWnd | Handle to the parent window to be used with the TWAIN initialization process. This must be a valid window handle (may not be set to NULL).
szManufacturerName | Character string that contains the manufacturer's name (optional).
szAppProductFamily | Character string that contains the application product family (optional).
szVersionInfo | Character string that contains the version info (optional).
szAppName | Character string that contains the application name (optional).

Comments

pAPPLICATIONDATA is a pointer to a APPLICATIONDATA structure. Where the function parameter type is pAPPLICATIONDATA, you can declare an APPLICATIONDATA variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pAPPLICATIONDATA variable is necessary only if your program requires a pointer.

APPLICATIONDATA is used with the LTwain::InitSession function.


DATATRANSFER

typedef struct _DATATRANSFER
{

L_UINT uStructSize;
L_INT nFillOrder;
L_INT nBufMemCompression;
L_INT nTransferMode;
L_INT nScanFileFormat;
L_INT nMemBufSize;
L_BOOL bSaveToOneFile;
L_BOOL bAppendToFile;
L_BOOL bDumpMemBufsToFile;
L_TCHAR szFileName [250];
} DATATRANSFER, L_FAR * pDATATRANSFER;

The DATATRANSFER structure provides information about data transferring.

Member | Description
uStructSize | Size of the DATATRANSFER structure, in bytes, for versioning. Use the sizeof() macro to calculate the value.
nFillOrder | Indicates how bytes in the image are to be filled by the source. Possible values are (according to the TWAIN 1.9 specification):
 | Value | Meaning
 | TWBO_LSBFIRST | Bytes are to be transferred with the least significant byte first.
 | TWBO_MSBFIRST | Bytes are to be transferred with the most significant byte first.
nBufMemCompression | Specifies the compression to be used when having the transfer mode set to be memory. Possible values are (according to the TWAIN 1.9 specification):
 | Value | Meaning
 | TWCP_NONE | No compression is to be used.
 | TWCP_PACKBITS | Pack Bits compression.
 | TWCP_GROUP31D | CCITT Group 3 compression with no End of Line.
 | TWCP_GROUP31DEOL | CCITT Group 3 compression with End of Line.
 | TWCP_GROUP32D | CCITT Group 3 compression (use cap for K Factor).
 | TWCP_GROUP4 | CCITT Group 4 compression.
 | TWCP_JPEG | JPEG compression.
 | TWCP_LZW | LZW compression (like gifs).
 | TWCP_JBIG | JBIG compression, used mostly for bitonal images.
 | TWCP_PNG | PNG compressed.
 | TWCP_RLE4 | RLE4 compression.
 | TWCP_RLE8 | RLE8 compression.
 | TWCP_BITFIELDS | Bit Fields compression.
nTransferMode | Transfer mode to be used by the TWAIN source. Possible values are (according to the TWAIN 1.9 specification):
 | Value | Meaning
 | TWSX_NATIVE | Native transfer mode.
 | TWSX_MEMORY | Memory buffered transfer mode. The source will be transferring strips of data to the application according to the buffer size given.
 | TWSX_FILE | File transfer mode. This will use a specified file to have the image data saved to. This will have a certain format specified by the properties.
nScanFileFormat | Determines the file format to use when saving the files from the TWAIN source. Possible values are (according to the TWAIN 1.9 specification) :
 | Value | Meaning
 | TWFF_TIFF | Tagged image file.
 | TWFF_PICT | Macintosh PICT.
 | TWFF_BMP | Windows regular bitmap.
 | TWFF_XBM | X-Windows bitmap.
 | TWFF_JFIF | JPEG file interchange format.
 | TWFF_FPX | Flash pix file.
 | TWFF_TIFFMULTI | Multi-page tiff file format.
 | TWFF_PNG | PNG file.
 | TWFF_SPIFF | SPIFF file.
 | TWFF_EXIF | EXIF file.
nMemBufSize | Specifies the memory buffer size to be used in data transfer.
bSaveToOneFile | Flag that indicates whether to save a multiple pages to a single file. Possible values are:
 | Value | Meaning
 | TRUE | Save to a single file.
 | FALSE | Do not save to a single file.
bAppendToFile | Flag that indicates whether to append pages to the end of the file when saving a multi-page file. Possible values are:
 | Value | Meaning
 | TRUE | Append pages to the end of the file.
 | FALSE | Do not append pages to the end of the file.
bDumpMemBufsToFile | Flag that indicates whether to use the file name specified in szFileName field to dump the memory buffers received from the scanner. In this case the Bitmap Handle will not get the Bitmap Data, all the data will be saved to the file. Possible values:
 | Value | Meaning
 | TRUE | Use file name.
 | FALSE | Do not use file name.
szFileName | Character string that contains the file name used in the file transfer mode.

Comments

pDATATRANSFER is a pointer to a DATATRANSFER structure. Where the function parameter type is pDATATRANSFER, you can declare a DATATRANSFER variable, update the structure's fields and pass the variable's address in the parameter. Declaring a pDATATRANSFER variable is necessary only if your program requires a pointer.

DATATRANSFER is used with the LTWAINPROPERTIES structure.


FASTCONFIG

typedef struct _FASTCONFIG
{

L_UINT uStructSize;
L_UINT uTransferMode;
L_INT nFileFormat;
L_UINT32 ulBufferSize;
L_UINT uTime;
L_INT nBitsPerPixel;
L_BOOL bSuccess;
} FASTCONFIG, L_FAR * pFASTCONFIG;

The FASTCONFIG structure provides information about a scan configuration to be tested or a scan configuration that is the result of testing.

Member | Description
uStructSize | Size of the FASTCONFIG structure, in bytes, for versioning. Use the sizeof() macro to calculate the value.
uTransferMode | Transfer mode for the scan configuration(s). The possible values are:
 | Value | Meaning
 | LTWAIN_FILE_MODE | [0x001] Use File transfer mode
 | LTWAIN_BUFFER_MODE | [0x002] Use Memory transfer mode
 | LTWAIN_NATIVE_MODE | [0x004] Use Native transfer mode
nFileFormat | Determines the file format that will be used to save scanned images using this scan configuration. Possible values depend on the value of uTransferMode.
 | If uTransferMode is LTWAIN_FILE_MODE, the possible values are: TWFF_TIFF TWFF_PICT TWFF_BMP TWFF_XBM TWFF_JFIF TWFF_FPX TWFF_TIFFMULTI TWFF_PNG TWFF_SPIFF TWFF_EXIF
 | If uTransferMode is LTWAIN_BUFFER_MODE, the possible values are: FILE_FAX_G4 FILE_FAX_G3_2D FILE_FAX_G3_1D FILE_FAX_G3_1D_NOEOL FILE_JBIG FILE_TIF_JPEG FILE_JPEG_411 FILE_JPEG_422 FILE_JPEG FILE_TIF
 | If uTransferMode is LTWAIN_NATIVE_MODE, the possible values are: FILE_CCITT_GROUP4 FILE_BMP FILE_JPEG FILE_TIF
ulBufferSize | Determines the buffer size that will be used with the buffer transfer mode. If this value is 0, then use the twain driver preferred buffer size.
uTime | The amount of time required to scan the pages used for testing the scan configuration. The number of pages depends on how many pages the user loads in the scanner when testing a scan configuration. The same pages should be used for each test.
nBitsPerPixel | Bits per pixel that will be used.
bSuccess | Specifies whether the configuration being tested succeeded. Possible values are:
 | Value | Meaning
 | TRUE | The current scan configuration was successful.
 | FALSE | The current scan configuration was not successful.

Comments

pFASTCONFIG is a pointer to a FASTCONFIG structure. Where the function parameter type is pFASTCONFIG, you can declare an FASTCONFIG variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pFASTCONFIG variable is necessary only if your program requires a pointer.

FASTCONFIG is used with the LTwain::FindFastConfig,
 LTwain::GetScanConfigs
 and LTwain::FreeScanConfig
 functions.


HTWAINTEMPLATEFILE

LEADTOOLS has defined the following data types for referencing TWAIN template file:

Data Type | Definition and Usage
HTWAINTEMPLATEFILE | Defined as HANDLE; used as a handle of a TWAIN template file.
pHTWAINTEMPLATEFILE | Defined as HTWAINTEMPLATEFILE *; used as a pointer to a TWAIN template file handle.


IMAGEEFFECTS

typedef struct _IMAGEEFFECTS
{

L_UINT uStructSize;
L_INT nPixFlavor;
L_INT nColorScheme;
L_FLOAT fHighLight;
L_FLOAT fShadow;
L_FLOAT fBrightness;
L_FLOAT fContrast;
L_TCHAR szHalfTone[32];
} IMAGEEFFECTS, L_FAR * pIMAGEEFFECTS;

The IMAGEEFFECTS structure provides information about the image effects.

Member | Description
uStructSize | Size of the IMAGEEFFECTS structure, in bytes, for versioning. Use the sizeof() macro to calculate the value.
nPixFlavor | Pixel flavor used when acquiring. Possible values are (according to the TWAIN 1.9 specification):
 | Value | Meaning
 | TWPF_CHOCOLATE | Zero stands for the darkest shade.
 | TWPF_VANILLA | Zero stands for the lightest shade.
nColorScheme | Color scheme to use when scanning is to be done. Possible values are (according to the TWAIN 1.9 specification):
 | Value | Meaning
 | TWPT_BW | Black and White (1 bit).
 | TWPT_GRAY | 8-bit Gray Scale
 | TWPT_RGB | 24-bit RGB Color.
 | TWPT_PALETTE | 8-bit Color.
 | TWPT_CMY | CYAN, magenta, yellow color space.
 | TWPT_CMYK | CYAN, magenta, yellow, black color space.
 | TWPT_YUV | Color space type that is true color encoding. It uses one luminance value (Y) and two chroma values (UV).
 | TWPT_YUVK | The same as YUV with an additional black variable.
 | TWPT_CIEXYZ | Chromaticity diagram.
fHighLight | Highlight value.
fShadow | Shadow value.
fBrightness | Brightness value.
fContrast | Contrast value.
szHalfTone | A string having the name of the used pattern.

Comments

pIMAGEEFFECTS is a pointer to a IMAGEEFFECTS structure. Where the function parameter type is pIMAGEEFFECTS, you can declare an IMAGEEFFECTS variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pIMAGEEFFECTS variable is necessary only if your program requires a pointer.

IMAGEEFFECTS is used with the LTWAINPROPERTIES structure.


IMAGERESOLUTION

typedef struct _IMAGERESOLUTION
{

L_UINT uStructSize;
L_INT nUnitOfResolution;
L_INT nBitsPerPixel;
L_FLOAT fHorzResolution;
L_FLOAT fVertResolution;
L_FLOAT fXScaling;
L_FLOAT fYScaling;
L_FLOAT fRotationAngle;
L_FLOAT fLeftMargin;
L_FLOAT fRightMargin;
L_FLOAT fTopMargin;
L_FLOAT fBottomMargin;
} IMAGERESOLUTION, L_FAR * pIMAGERESOLUTION;

The IMAGERESOLUTION structure provides information about the images effects.

Member | Description
uStructSize | Size of the IMAGERESOLUTION structure, in bytes, for versioning. Use the sizeof() macro to calculate the value.
nUnitOfResolution | An integer having the unit of resolution to use. Possible values are (according to the TWAIN 1.9 specification):
 | Value | Meaning
 | TWUN_INCHES | Inches unit.
 | TWUN_CENTIMETERS | Centimeters unit.
 | TWUN_PICAS | Picas unit.
 | TWUN_POINTS | Points unit.
 | TWUN_TWIPS | Twips unit.
 | TWUN_PIXELS | Pixels unit.
nBitsPerPixel | Bits per pixel the acquired images will have.
fHorzResolution | Horizontal resolution of the TWAIN source while acquiring the images.
fVertResolution | Vertical resolution of the TWAIN source while acquiring the images.
fXScaling | The acquired image X-direction scaling value before transferring.
fYScaling | The acquired image X-direction scaling value before transferring.
fRotationAngle | The acquired image rotation angle value before transfer.
fLeftMargin | The left margin of the scanning area.
fRightMargin | The right margin of the scanning area.
fTopMargin | The top margin of the scanning area.
fBottomMargin | The bottom margin of the scanning area.

Comments

pIMAGERESOLUTION is a pointer to a IMAGERESOLUTION structure. Where the function parameter type is pIMAGERESOLUTION, you can declare an IMAGERESOLUTION variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pIMAGERESOLUTION variable is necessary only if your program requires a pointer.

IMAGERESOLUTION is used with the LTWAINPROPERTIES structure.


LTWAINNUMERICTYPE

typedef enum _LTWAINNUMERICTYPE
{
TWAINNUMERICTYPE_TW_INT8 = TWTY_INT8,
TWAINNUMERICTYPE_TW_INT16 = TWTY_INT16,
TWAINNUMERICTYPE_TW_INT32 = TWTY_INT32,
TWAINNUMERICTYPE_TW_UINT8 = TWTY_UINT8,
TWAINNUMERICTYPE_TW_UINT16 = TWTY_UINT16,
TWAINNUMERICTYPE_TW_UINT32 = TWTY_UINT32,
TWAINNUMERICTYPE_TW_BOOL = TWTY_BOOL,
TWAINNUMERICTYPE_TW_FIX32 = TWTY_FIX32,
TWAINNUMERICTYPE_TW_FRAME = TWTY_FRAME,
TWAINNUMERICTYPE_TW_STR32 = TWTY_STR32,
TWAINNUMERICTYPE_TW_STR64 = TWTY_STR64,
TWAINNUMERICTYPE_TW_STR128 = TWTY_STR128,
TWAINNUMERICTYPE_TW_STR255 = TWTY_STR255,
TWAINNUMERICTYPE_TW_STR1024 = TWTY_STR1024,
TWAINNUMERICTYPE_TW_UNI512 = TWTY_UNI512
} LTWAINNUMERICTYPE;

The LTWAINNUMERICTYPE enumerates the defined types of variables.

Member | Description
TWAINNUMERICTYPE_TW_INT8 | The variable is of type L_CHAR or char.
TWAINNUMERICTYPE_TW_INT16 | The variable is of type L_INT16 or short.
TWAINNUMERICTYPE_TW_INT32 | The variable is of type L_INT32 or long.
TWAINNUMERICTYPE_TW_UINT8 | The variable is of type L_UCHAR or unsigned char.
TWAINNUMERICTYPE_TW_UINT16 | The variable is of type L_UINT16 or unsigned short.
TWAINNUMERICTYPE_TW_UINT32 | The variable is of type L_UINT32 or unsigned long.
TWAINNUMERICTYPE_TW_BOOL | The variable is of type L_BOOL or BOOL.
TWAINNUMERICTYPE_TW_FIX32 | The variable is of type TW_FIX32(TWAIN defined structure).
TWAINNUMERICTYPE_TW_FRAME | The variable is of type TW_FRAME(TWAIN defined structure).
TWAINNUMERICTYPE_TW_STR32 | The variable is of type L_CHAR[32].
TWAINNUMERICTYPE_TW_STR64 | The variable is of type L_CHAR[64].
TWAINNUMERICTYPE_TW_STR128 | The variable is of type L_CHAR[128].
TWAINNUMERICTYPE_TW_STR255 | The variable is of type L_CHAR[255].
TWAINNUMERICTYPE_TW_STR1024 | The variable is of type L_CHAR[1024].
TWAINNUMERICTYPE_TW_UNI512 | The variable is of type wchar_t[512].


LTWAINPROPERTIES

typedef struct _LTWAINPROPERTIES
{

L_UINT uStructSize;
L_BOOL bPaperSource;
L_INT nMaxNumOfPages;
L_INT nDuplexScanning;
IMAGERESOLUTION ImageRes;
DATATRANSFER DataTransfer;
IMAGEEFFECTS ImageEff;
} LTWAINPROPERTIES, L_FAR * pLTWAINPROPERTIES;

The LTWAINPROPERTIES structure provides information about the available TWAIN properties.

Member | Description
uStructSize | Size of the LTWAINPROPERTIES structure, in bytes, for versioning. Use the sizeof() macro to calculate the value.
bPaperSource | Flag that indicates whether to use the Auto - Feed capability of the selected TWAIN source. Possible values are:
 | Value | Meaning
 | TRUE | Use the Auto - Feed capability.
 | FALSE | Do not use the Auto - Feed capability.
nMaxNumOfPages | The maximum number of pages to get from the TWAIN source. (If the function updates this field to -1, it means that the number of pages is unlimited.)
nDuplexScanning | Sets the type of duplex scanning. Possible values are (according to the TWAIN 1.9 specification):
 | Value | Meaning
 | TWDX_NONE | No duplex used.
 | TWDX_1PASSDUPLEX | 1 pass duplex.
 | TWDX_2PASSDUPLEX | 2 pass duplex.
ImageRes | A structure of type IMAGERESOLUTION that contains image resolution data for the TWAIN source.
DataTransfer | A structure of type DATATRANSFER that contains data transfer information for the TWAIN source.
ImageEff | A structure of type IMAGEEFFECTS that contains image effects information for the TWAIN source.

Comments

pLTWAINPROPERTIES is a pointer to a LTWAINPROPERTIES structure. Where the function parameter type is pLTWAINPROPERTIES, you can declare an LTWAINPROPERTIES variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pLTWAINPROPERTIES variable is necessary only if your program requires a pointer.

LTWAINPROPERTIES is used with the LTwain::GetProperties and LTwain::SetProperties functions.


LTWAINPROPERTYQUERY

typedef struct _LTWAINPROPERTYQUERY
{

L_UINT uStructSize;
L_UINT uType;
union
{
pTW_ONEVALUE pltwOneValue;
pTW_RANGE pltwRange;
pTW_ENUMERATION pltwEnumeration;
pTW_ARRAY pltwArray;
};
} LTWAINPROPERTYQUERY, L_FAR * pLTWAINPROPERTYQUERY;

The LTWAINPROPERTYQUERY structure provides information about the capability properties.

Member | Description
uStructSize | Size of the LTWAINPROPERTYQUERY structure, in bytes, for versioning. Use the sizeof() macro to calculate the value.
uType | Holds the type of pointer to use from the union. Possible values are (according to the TWAIN 1.9 specification):
 | Value | Meaning
 | TWON_ONEVALUE | The container is of type TW_ONEVALUE and only the pltwOneValue pointer is used.
 | TWON_RANGE | The container is of type TW_RANGE and only the pltwRange pointer is used.
 | TWON_ONEVALUE | The container is of type TW_ENUMERATION and only the pltwEnumeration pointer is used.
 | TWON_ONEVALUE | The container is of type TW_ARRAY and only the pltwArray pointer is used.
pltwOneValue | Pointer to a TW_ONEVALUE structure.
pltwRange | Pointer to a TW_RANGE structure.
pltwEnumeration | Pointer to a TW_ENUMERATION structure.
pltwArray | Pointer to a TW_ARRAY structure.

Comments

pLTWAINPROPERTYQUERY is a pointer to a LTWAINPROPERTYQUERY structure. Where the function parameter type is pLTWAINPROPERTYQUERY, you can declare an LTWAINPROPERTYQUERY variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pLTWAINPROPERTYQUERY variable is necessary only if your program requires a pointer.

LTWAINPROPERTIES is allocated by the LTwain::QueryProperty function and freed by LTwain::FreePropQueryStructure function.


LTWAINSOURCE

typedef struct _LTWAINSOURCE
{

L_UINT uStructSize;
L_TCHAR * pszTwainSourceName;
} LTWAINSOURCE, L_FAR * pLTWAINSOURCE;

The LTWAINSOURCE structure provides information about the available TWAIN source.

Member | Description
uStructSize | Size of the LTWAINSOURCE structure, in bytes, for versioning. Use the sizeof() macro to calculate the value.
pszTwainSourceName | Character string that contains the name of the required TWAIN source.

Comments

pLTWAINSOURCE is a pointer to a LTWAINSOURCE structure. Where the function parameter type is pLTWAINSOURCE, you can declare an LTWAINSOURCE variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pLTWAINSOURCE variable is necessary only if your program requires a pointer.

LTWAINSOURCE is used with the LTwain::SelectSource function.


LTWAINSOURCEINFO

typedef struct _LTWAINSOURCEINFO
{

L_UINT uStructSize;
L_TCHAR * pszTwnSourceName;
L_TCHAR * pszTwnProductFamily;
L_TCHAR * pszTwnManufacturer;
} LTWAINSOURCEINFO, L_FAR * pLTWAINSOURCEINFO;

The LTWAINSOURCEINFO structure provides information about the available TWAIN source.

Member | Description
uStructSize | Size of the LTWAINSOURCEINFO structure, in bytes, for versioning. Use the sizeof() macro to calculate the value.
pszTwainSourceName | Character string that contains the name of the TWAIN source.
PszTwnProductFamily | Character string that contains the scanner product family name.
pszTwnManufacturer | Character string that contains the manufacturer name of the scanner.

Comments

pLTWAINSOURCEINFO is a pointer to a LTWAINSOURCEINFO structure. Where the function parameter type is pLTWAINSOURCEINFO, you can declare an LTWAINSOURCEINFO variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pLTWAINSOURCEINFO variable is necessary only if your program requires a pointer.

LTWAINSOURCEINFO is used with the LTwain::SourceInfoCallBack function.


TRANSFEROPTIONS

typedef struct _tagTransferOptions
{
L_UINT uStructSize;
TWAIN_TRANSFER_MODES TransferMode;
L_TCHAR szFileName[L_MAX_PATH];
L_UINT uFileFormat;
L_UINT uCompType;
} TRANSFEROPTIONS, L_FAR * pTRANSFEROPTIONS;

The TRANSFEROPTIONS structure provides information about transfer options to be used in the acquisition process.

Member | Description
uStructSize | Size of this structure in bytes, for versioning. Use the sizeof() macro to calculate this value.
TransferMode | Specifies the transfer mode. For possible values, refer to the TWAIN_TRANSFER_MODES enumeration.
szFileName | Character string that contains the file name to transfer if the TransferMode is set to TWAIN_TRANSFER_FILE flag.
uFileFormat | The file format to transfer if the TransferMode is set to TWAIN_TRANSFER_FILE flag. For more information about the supported file formats, refer to the Formats of Input Files .
uCompType | The compression type to be used if the TransferMode is set to TWAIN_TRANSFER_MEMORY flag.

Comments

pTRANSFEROPTIONS is a pointer to a TRANSFEROPTIONS structure. Where the function parameter type is pTRANSFEROPTIONS, you can declare a TRANSFEROPTIONS variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pTRANSFEROPTIONS variable is necessary only if your program requires a pointer.

TRANSFEROPTIONS is used with the LTwain::SetTransferOptions and LTwain::GetTransferOptions functions.


TWAIN_TRANSFER_MODES

typedef enum
{
TWAIN_TRANSFER_FILE = 0x001,
TWAIN_TRANSFER_MEMORY = 0x002,
TWAIN_TRANSFER_NATIVE = 0x004,
} TWAIN_TRANSFER_MODES;

Determines the transfer mode.

Value | Meaning
TWAIN_TRANSFER_FILE | [0x001] Specifies the file transfer mode.
TWAIN_TRANSFER_MEMORY | [0x002] Specifies the memory transfer mode.
TWAIN_TRANSFER_NATIVE | [0x004] Specifies the native transfer mode.


Return Codes

For a list of all possible return codes for LEADTOOLS Twain Class Library functions, refer to LEADTOOLS Class Library Return Codes in the Main Class Library help file.


LTwain

Description

The LTwain class is derived from LScanner and provides support for acquiring images from TWAIN compatible data sources such as scanners and digital cameras. This class provides functionality for enumerating and selecting TWAIN data sources, displaying the data source's built-in user interface, acquiring single or multiple images, and setting acquisition parameters without using the built-in UI.

Required Libraries

You must load all required libraries using LBase::LoadLibraries before using the classes.

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Member Functions, Class Hierarchy Chart , Parent class


LTwain::Member Functions

Constructors / Destructors

Creating a Twain Session

Working with Capabilities

Working with Containers

Sources and Properties

Template Functions

Extended Image Information

Fast Twain (Scan Configurations)

Overridables

JPEG Compression

Return to LTwain

Acquiring Images

LTwain::Acquire

LTwain::AcquireList

Constructors / Destructors

LTwain::LTwain

LTwain::~LTwain

Creating a Twain Session

LTwain::InitSession

LTwain::EndSession

Working with Capabilities

LTwain::AddCapabilityToFile

LTwain::EnumCapabilities

LTwain::GetAcquirePageOptions

LTwain::GetCapability

LTwain::GetCapabilityFromFile

LTwain::GetDuplexOptions

LTwain::GetImageBitsPerPixel

LTwain::GetImageEffects

LTwain::GetImageFrame

LTwain::GetImageUnit

LTwain::GetMaxXferCount

LTwain::GetNumOfCapsInFile

LTwain::GetResolution

LTwain::GetSupportedTransferMode

LTwain::GetTransferOptions

LTwain::SetAcquirePageOptions

LTwain::EnableDuplex

LTwain::SetCapability

LTwain::SetImageBitsPerPixel

LTwain::SetImageEffects

LTwain::SetImageFrame

LTwain::SetImageUnit

LTwain::SetMaxXferCount

LTwain::SetResolution

LTwain::SetRGBResponse

LTwain::SetTransferOptions

LTwain::ShowProgress

Working with Containers

LTwain::GetNumericContainerValue

LTwain::GetNumericContainerItemType

LTwain::GetNumericContainerINTValue

LTwain::GetNumericContainerUINTValue

LTwain::GetNumericContainerBOOLValue

LTwain::GetNumericContainerFIX32Value

LTwain::GetNumericContainerFRAMEValue

LTwain::GetNumericContainerSTRINGValue

LTwain::GetNumericContainerUNICODEValue

LTwain::CreateNumericContainerOneValue

LTwain::CreateNumericContainerRange

LTwain::CreateNumericContainerArray

LTwain::CreateNumericContainerEnum

LTwain::FreeContainer

LTwain::LockContainer

LTwain::UnlockContainer

Sources and Properties

LTwain::FreePropQueryStructure

LTwain::GetProperties

LTwain::GetSources

LTwain::IsAvailable

LTwain::SelectSource

LTwain::SetProperties

LTwain::QueryProperty

Template Functions

LTwain::CloseTemplateFile

LTwain::TemplateDlg

LTwain::OpenTemplateFile

Extended Image Information

LTwain::FreeExtendedImageInfoStructure

LTwain::GetExtendedImageInfo

Fast Twain (Scan Configurations)

LTwain::AcquireMulti

LTwain::FindFastConfig

LTwain::GetScanConfigs

LTwain::FreeScanConfig

Overridables

LTwain::AcquireCallBack

LTwain::AcquireCallBack

LTwain::BitmapCallBack

LTwain::CapabilityCallBack

LTwain::FindFastConfigCallBack

LTwain::SaveCapCallBack

LTwain::SaveErrorCallBack

LTwain::SetPropertyCallBack

LTwain::SourceInfoCallBack

JPEG Compression

LTwain::GetJPEGCompression

LTwain::SetJPEGCompression


LTwain::LTwain

#include "ltwrappr.h"

L_VOID LTwain::LTwain(void)

Constructs and initializes the LTwain object.

Returns

None

Comments

LTwain::LTwain() is a constructor for the LTwain class.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LTwain::~LTwain, Class Members

Example

//This is an example for LTwain::LTwain():

L_VOID TestFunction()
{
// this will call the default constructor and destructor when it is out of scope
LTwain MyTwain ;

//…
}


LTwain::~LTwain

#include "ltwrappr.h"

virtual L_VOID LTwain::~LTwain(void)

Destroys the object and frees any resources associated with it.

Returns

None

Comments

This is the destructor for the LTwain class.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LTwain::LTwain, Class Members

Example


LTwain::Acquire

#include "ltwrappr.h"

virtual L_INT LTwain::Acquire (pBitmap, uStructSize, uFlags, lpszTemplateFile)

virtual L_INT LTwain::Acquire (Bitmap, uStructSize, uFlags, lpszTemplateFile)

pBITMAPHANDLE pBitmap; | /* pointer to the bitmap handle */
LBitmap * Bitmap; | /* pointer to an LBitmap object */
L_UINT uStructSize | /* size in bytes, of the structure pointed to by pBitmap */
L_UINT uFlags; | /* optional flags */
L_TCHAR * lpszTemplateFile; | /* template file name */

Acquires one or more images from a TWAIN source.

Parameter | Description
pBitmap | Pointer to the bitmap handle that references the last bitmap acquired from the TWAIN source.
Bitmap | Pointer to an LBitmap object that references the last bitmap acquired from the TWAIN source.
uStructSize | Size of the BITMAPHANDLE structure pointed to by pBitmap, in bytes, for versioning. Use sizeof(BITMAPHANDLE).
uFlags | Flag that indicates whether to display the manufacturer's user interface. Possible values are:
 | Value | Meaning
 | 0 | [0] Do not show the manufacturer's user interface.
 | LTWAIN_SHOW_USER_INTERFACE | [1] Shows the manufacturer's user interface as modeless.
 | LTWAIN_MODAL_USER_INTERFACE | [2] Shows the manufacturer's user interface as a modal dialog. Works only if the LTWAIN_SHOW_USER_INTERFACE flag is set.
lpszTemplateFile | Character string that contains the name of the template file in which the TWAIN source capability settings will be saved. If this parameter is NULL, the TWAIN capability settings used will not be saved to a template file. For more information on determining/setting the capabilities for a TWAIN source, refer to Getting and Setting Capabilities.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

When acquiring multiple pages, the LTwain::BitmapCallBack function receives the scanned images through the pBitmap parameter. The user can then process these images as desired within the callback function.

When acquiring a single page, pass NULL for the pfnCallBack parameter. The pBitmap is updated with the single scanned image.

The number of pages to acquire can be determined by getting the TWAIN source's capabilities. To change the number of pages to acquire, set the appropriate capability to the desired number.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::BitmapCallBack, LTwain::AcquireList, LTwain::InitSession, LTwain::EndSession, LTwain::OpenTemplateFile, LTwain::CloseTemplateFile, LTwain::TemplateDlg, LTwain::AddCapabilityToFile, LTwain::GetNumofCapsInFile, LTwain::GetCapabilityFromFile.
Topics: | How to Acquire from the TWAIN Source
 | TWAIN Functionality: Property Functions.

Example

class CMyTwain : public LTwain
{
public:
L_INT BitmapCallBack(pBITMAPHANDLE pBitmap);

HTWAINTEMPLATEFILE m_hFile;
};

L_INT CMyTwain::BitmapCallBack(pBITMAPHANDLE pBitmap)
{
// You can do here any processing to the bitmap
return SUCCESS;
}

// initialize session and call this function
void TwainAcquire (pBITMAPHANDLE pBitmap, HWND hWnd)
{
L_INT nRet;
TW_CAPABILITY twCap;
CMyTwain MyClass;

// Show the Twain Select Source UI
nRet = MyClass.SelectSource(NULL);
if (nRet != SUCCESS)
MessageBox (NULL, TEXT("Error occurred while selecting the source."), TEXT("ERROR"), MB_OK);

twCap.Cap = ICAP_XFERMECH;
twCap.ConType = TWON_ONEVALUE;

MyClass.CreateNumericContainerOneValue(&twCap, TWAINNUMERICTYPE_TW_UINT16, TWSX_NATIVE);

MyClass.SetCapability( &twCap, LTWAIN_CAPABILITY_SET);
MyClass.FreeContainer(&twCap);

MyClass.EnableCallBack
 (TRUE);

nRet = MyClass.Acquire( pBitmap, sizeof(BITMAPHANDLE), LTWAIN_SHOW_USER_INTERFACE, NULL);
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("The image acquisition process completed."), TEXT("Notice"), MB_OK);
else
MessageBox(NULL, TEXT(" The image acquisition process failed!"), TEXT("Error"), MB_OK);
}


LTwain::AcquireCallBack

#include "ltwrappr.h"

virtual L_VOID LTwain::AcquireCallBack (nPage, pszFileName, bFinishScan)

L_INT nPage; | /* page number */
L_TCHAR L_FAR * pszFileName; | /* file name */
L_BOOL bFinishScan; | /* flag to determine if the scanning status */

Called twice for each page scanned using LTwain::AcquireMulti. This function is available in the Document/Medical Toolkits .

Parameter | Description
nPage | Number of the page being acquired
pszFileName | Character string containing the name of the file in which to save the scanned image(s).
bFinishScan | Flag that indicates the scanning status. Possible values are:
 | Value | Meaning
 | TRUE | Scanning of the page has finished.
 | FALSE | Scanning of the page has just started.

Comments

This callback function will be enabled only if you enabled the callback functions by calling LBase::EnableCallBack (TRUE).

This callback will be called two times. The callback is called the first time when the Twain source begins scanning the page. The callback is called the second time when the Twain source has finished scanning the page.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::Acquire, LTwain::AcquireList, LTwain::InitSession, LTwain::EndSession, LTwain::OpenTemplateFile, LTwain::CloseTemplateFile, LTwain::TemplateDlg, LTwain::AddCapabilityToFile, LTwain::GetNumofCapsInFile, LTwain::GetCapabilityFromFile, LTwain::AcquireMulti, LTwain::FindFastConfig, LTwain::GetScanConfigs, LTwain::FreeScanConfig.
Topics: | How to Acquire from the Twain Source
 | TWAIN Functionality:Property Functions

Example

For an example, refer to LTwain::AcquireMulti.


LTwain::AcquireList

#include "ltwrappr.h"

virtual L_INT LTwain::AcquireList (hBitmap, lpszTemplateFile, uFlags)

virtual L_INT LTwain::AcquireList (BitmapList, lpszTemplateFile, uFlags)

HBITMAPLIST hBitmap; | /* handle to the list of bitmaps */
LBitmapList * BitmapList; | /* pointer to an LBitmapList object */
L_TCHAR * lpszTemplateFile; | /* template file name */
L_UINT uFlags; | /* optional flags */

Acquires one or more pages from a TWAIN source and stores the images in the specified bitmap list.

Parameter | Description
hBitmap | Handle to the list of bitmaps acquired from the selected TWAIN source.
BitmapList | Pointer to an LBitmapList object that references the list of bitmaps acquired from the selected TWAIN source.
lpszTemplateFile | Character string that contains the name of the template file in which the TWAIN source capability settings will be saved. If this parameter is NULL, the TWAIN capability settings used will not be saved to a template file. For more information on determining/setting the capabilities for a TWAIN source, refer to Getting and Settings Capabilities.
uFlags | Flags that indicate whether to display the manufacturer's user interface. Possible values are:
 | Value | Meaning
 | LTWAIN_SHOW_USER_INTERFACE | [1] Shows the manufacturer's user interface as modeless.
 | LTWAIN_MODAL_USER_INTERFACE | [2] Shows the manufacturer's user interface as a modal dialog. Works only if the LTWAIN_SHOW_USER_INTERFACE flag is set.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function acquires one or more images from a TWAIN source and stores them in the specified bitmap list. If the user wants to acquire one or more images and process each one individually, he or she should use the LTwain::Acquire function an provide an LTwain::BitmapCallBack function for processing each image.

The number of pages to acquire can be determined by getting the TWAIN source's capabilities. To change the number of pages to acquire, set the appropriate capability to the desired number.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::Acquire, LTwain::InitSession, LTwain::EndSession, LTwain::OpenTemplateFile, LTwain::CloseTemplateFile, LTwain::TemplateDlg, LTwain::AddCapabilityToFile, LTwain::GetNumofCapsInFile, LTwain::GetCapabilityFromFile.
Topics: | How to Acquire from the TWAIN Source
 | TWAIN Functionality: Property Functions.

Example

For an example, refer to LTwain::IsAvailable.


LTwain::AcquireMulti

#include "ltwrappr.h"

virtual L_INT LTwain::AcquireMulti(pszBaseFileName, uFlags, uTransferMode, nFormat, nBitsPerPixel, bMultiPageFile, uUserBufSize, bUsePreferredBuffer)

L_TCHAR L_FAR *pszBaseFileName; | /* base string */
L_UINT uFlags; | /* option flags */
L_UINT uTransferMode; | /* transfer mode */
L_INT nFormat; | /* output file format */
L_INT nBitsPerPixel; | /* resulting file’s pixel depth */
L_BOOL bMultiPageFile; | /* naming flag */
L_UINT32 uUserBufSize; | /* user-defined buffer size */
L_BOOL bUsePreferredBuffer; | /* buffer size flag */

Acquires one or more images from a TWAIN source and stores the images in the specified file(s). This function is available in the Document/Medical Toolkits.

Parameter | Description
pszBaseFileName | Character string containing the base name of the image file(s) in which to save the acquired data.
uFlags | Flag that indicates whether to display the manufacturer's user interface. Possible values are:
 | Value | Meaning
 | 0 | [0] Do not show the manufacturer's user interface.
 | LTWAIN_SHOW_USER_INTERFACE | [1] Shows the manufacturer's user interface as modeless.
 | LTWAIN_MODAL_USER_INTERFACE | [2] Shows the manufacturer's user interface as a modal dialog. Works only if the LTWAIN_SHOW_USER_INTERFACE flag is set.
uTransferMode | Flag that indicates the transfer mode to use when acquiring the image(s). Possible values are:
 | Value | Meaning
 | LTWAIN_FILE_MODE | [0x001] Use the File transfer mode
 | LTWAIN_BUFFER_MODE | [0x002] Use the Memory transfer mode
 | LTWAIN_NATIVE_MODE | [0x004] Use the Native transfer mode
nFormat | Output file format. For valid values, refer to Formats of Output Files .
nBitsPerPixel | Resulting file's pixel depth. Note that not all bits per pixel are available to all file formats. For valid values, refer to Formats of Output Files . If nBitsPerPixel is 0, the file will be stored using the closest BitsPerPixel value supported by that format.
bMultiPageFile | Flag that indicates whether to save multiple images into a single multi-page file, or into a series of single page files. Possible values are:
 | Value | Meaning
 | TRUE | The scanned images will be saved in one multi-page file.
 | FALSE | Each scanned image will be saved in a separate file.
 | Notice that it the format doesn't support multi-page files, then each scanned page will be saved in a separate file.
uUserBufSize | Specifies a user-defined buffer size. This value will be used if uTransferMode is LTWAIN_BUFFER_MODE and the bUsePreferredBuffer parameter is FALSE. This value must be a multiple of 16.
bUsePreferredBuffer | Flag that indicates whether to use the user-defined buffer size or the Twain driver preferred buffer size. Possible values are:
 | Value | Meaning
 | TRUE | Use the Twain driver preferred buffer size.
 | FALSE | Use the user-defined buffer size in the uUserBufSize parameter.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function will acquire one or more images from a TWAIN source and store the images to the specified file(s).

Based on the scanner type, this function will determine the best/fastest scanning method to use. This method will be used when actually scanning the image(s). Before calling this function you can call LTwain::FindFastConfig to determine the best scan configuration and then pass the scan configuration information to the LTwain::AcquireMulti function. If you do not call LTwain::FindFastConfig before calling LTwain::AcquireMulti, then the LTwain::AcquireMulti function will determine the best scanning method.

If the file format specified in nFormat does not support multi-page files, this function will ignore the bMultiPageFile parameter and automatically save the scanned images in separate files. The naming of the files will be carried out as follows: if the string in pszBaseFileName is "Temp.jpg", the method will append the number of the image, 0001, 0002, etc, to the name of the file. Therefore, the output file names will be "Temp0001.jpg", "Temp0002.jpg", etc.

If the file format specified in nFormat supports multi-page files, this function will use the bMultiPageFile parameter to determine how to save multiple images. If bMultiPageFile is FALSE, each scanned page will be saved to a separate file, named in the same manner described in the paragraph above. If bMultiPageFile is TRUE, the name of the output file will be exactly the string in pszBaseFileName (Temp.jpg) and it will be saved as a multi-page file.

If uTransferMode is LTWAIN_BUFFER_MODE, and bUsePreferredBuffer is FALSE, then the function will use the user-defined buffer size in uUserBufSize. If however bUsePreferredBuffer is TRUE, then the function will use the Twain driver preferred buffer size and will ignore uUserBufSize.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::AcquireCallBack, LTwain::Acquire, LTwain::AcquireList, LTwain::InitSession, LTwain::EndSession, LTwain::OpenTemplateFile, LTwain::CloseTemplateFile, LTwain::TemplateDlg, LTwain::AddCapabilityToFile, LTwain::GetNumofCapsInFile, LTwain::GetCapabilityFromFile, LTwain::FindFastConfig, LTwain::GetScanConfigs, LTwain::FreeScanConfig.
Topics: | How to Acquire from the TWAIN Source
 | TWAIN Functionality: Property Functions.

Example

class CMyTwain : public LTwain
{
public:
L_VOID AcquireCallBack(L_INT nPage, L_TCHAR L_FAR * pszFileName, L_BOOL bFinishScan);
};

L_VOID CMyTwain::AcquireCallBack(L_INT nPage, L_TCHAR L_FAR * pszFileName, L_BOOL bFinishScan)
{
L_TCHAR szTemp[MAX_PATH];
if (bFinishScan)
{
wsprintf(szTemp, TEXT("The page # %d is scanned and saved to file name %s\n"), nPage, pszFileName);
MessageBox(NULL, szTemp, TEXT("Notice"), MB_OK);
}
}

L_INT TestFastTwain(HWND hWnd, CMyTwain *MyClass)
{
L_INT nRet;
L_BOOL bAvailable;

APPLICATIONDATA AppData;

/* Check to see if TWAIN is installed */
bAvailable = MyClass->IsAvailable();
if (bAvailable)
{
AppData.hWnd = hWnd;
lstrcpy (AppData.szManufacturerName, TEXT("LEAD Technologies, Inc."));
lstrcpy (AppData.szAppProductFamily, TEXT("LEAD Test Applications"));
lstrcpy (AppData.szVersionInfo, TEXT("Version 1.0"));
lstrcpy (AppData.szAppName, TEXT("TWAIN Test Application"));
nRet = MyClass->InitSession(&AppData);
}
MyClass->EnableCallBack
 (TRUE);
nRet = MyClass->AcquireMulti(
TEXT("c:\\test.bmp"),
LTWAIN_SHOW_USER_INTERFACE,
LTWAIN_FILE_MODE,
FILE_BMP,
1,
TRUE,
0,
TRUE);

if (nRet == SUCCESS)
MessageBox(hWnd, TEXT("Fast Twain function was successful"), TEXT("Notice"), MB_OK);
else
MessageBox(hWnd, TEXT("Error occurred during fast Twain function!!!"), TEXT("Error!!!"), MB_OK);

return nRet;
}


LTwain::AddCapabilityToFile

#include "ltwrappr.h"

virtual L_INT LTwain::AddCapabilityToFile (hFile, pCapability)

HTWAINTEMPLATEFILE hFile; | /* handle to an existing template file */
pTW_CAPABILITY pCapability; | /* pointer to a structure */

Adds a capability to a file.

Parameter | Description
hFile | Handle to an existing template file.
pCapability | Pointer to a structure that contains the capability to add.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

In order to add a capability to a template file, the template file must first be opened for writing using the LTwain::OpenTemplateFile. Opening the file for writing will create a new empty file. The process of adding capabilities to the file will add them sequentially. When all capabilities have been added, save the file by calling LTwain::CloseTemplateFile. For more information on capabilities, refer to Getting and Setting Capabilities.

For more information on Template files, refer to Handling Template Files.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::CapabilityCallback, LTwain::OpenTemplateFile, LTwain::TemplateDlg, LTwain::GetCapabilityFromFile, LTwain::GetNumOfCapsInFile, LTwain::CloseTemplateFile, LTwain::InitSession, LTwain::EndSession.
Topics: | Handling Template Files
 | TWAIN Functionality: Capability Functions.

Example

// Create your own class Inherited from LTwain
// to override the call back function
class CMyTwain : public LTwain
{
public:
L_INT CapabilityCallBack(L_UINT uCap, pTW_CAPABILITY pCapability);
HTWAINTEMPLATEFILE m_hFile;
};

// initialize session and call this function
void TestAddCapabilityToFile(CMyTwain *MyClass, HWND hWndParent)
{
OPENFILENAME ofn;
L_INT nRet;
L_TCHAR szFilePath [MAX_PATH];

memset (&ofn, 0, sizeof(OPENFILENAME));
memset (szFilePath, 0, MAX_PATH);
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hWndParent;
ofn.lpstrFile = szFilePath;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrTitle = TEXT("Save Template File");

if (GetSaveFileName (&ofn))
{
nRet = MyClass->OpenTemplateFile(&MyClass->m_hFile, szFilePath, LTWAIN_TEMPLATE_OPEN_WRITE);
if (nRet == SUCCESS)
{
MyClass->EnumCapabilities( LTWAIN_CAPABILITY_GETCURRENT );
MyClass->CloseTemplateFile( MyClass->m_hFile);
}
}
}

L_INT CMyTwain::CapabilityCallBack(L_UINT uCap, pTW_CAPABILITY pCapability)
{
L_INT nRet;

if (!pCapability)
return SUCCESS;

if (!pCapability->hContainer)
GlobalFree (pCapability);

nRet = AddCapabilityToFile(m_hFile, pCapability);

GlobalFree (pCapability->hContainer);
GlobalFree (pCapability);

return SUCCESS;
}


LTwain::BitmapCallBack

#include "ltwrappr.h"

virtual L_INT LTwain::BitmapCallBack (pBitmap)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

Handles each image provided by the calling function LTwain::Acquire.

Parameter | Description
pBitmap | Pointer to the bitmap handle that references the bitmap acquired from the TWAIN source. It is the same bitmap handle that you specify when calling the LTwain::Acquire function.

Returns

SUCCESS | The function was successful.
SUCCESS_ABORT | The callback wants to abort the scanning operation.
< 1 | An error occurred. Refer to Return Codes.

Comments

This callback function will be enabled only if you enabled the callback functions by calling LBase::EnableCallBack (TRUE). You must handle the image during this callback.

To prevent memory leaks, the user should free the bitmap within the callback function.

The LTwain::GetExtendedImageInfo function can only be called within LTwain::BitmapCallBack.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::Acquire, LTwain::GetExtendedImageInfo
Topics: | TWAIN Functionality: Callback Functions.

Example

For an example, refer to LTwain::Acquire.


LTwain::CapabilityCallBack

#include "ltwrappr.h"

virtual L_INT LTwain:: CapabilityCallBack (uCap, pCapability)

L_UINT uCap; | /* capability received */
pTW_CAPABILITY * pCapability; | /* pointer to a structure */

Handles each capability enumerated by the LTwain::EnumCapabilities function.

Parameter | Description
uCap | The capability being enumerated. For more information on capability values, refer to the Twain 1.9 Specification, available at www.twain.org.
pCapability | Pointer to the TW_CAPABILITY structure that references the capability data being enumerated. For more information about TW_CAPABILITY, refer to the TWAIN 1.9 specification from the site http://www.twain.org/.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This callback function will be enabled only if you enabled the callback functions by calling LBase::EnableCallBack (TRUE).

To prevent memory leaks, the user should free the pointer to TW_CAPABILITY structure within the callback function.

This structure can be freed by a call to LTwain::FreeContainer then you can free the pointer using GlobalFreePtr macro defined in Windows.h.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::EnumCapabilities.
Topics: | TWAIN Functionality: Callback Functions.

Example

For an example, refer to LTwain::AddCapabilityToFile.


LTwain::CloseTemplateFile

#include "ltwrappr.h"

virtual L_INT LTwain::CloseTemplateFile (hFile)

HTWAINTEMPLATEFILE hFile;

/* handle to an existing template file */

Closes the opened template file.

Parameter | Description
hFile | Handle to an existing template file.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Closes and saves the template file opened by calling the LTwain::OpenTemplateFile function.

For more information on template files, refer to Handling Template Files.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::OpenTemplateFile, LTwain::AddCapabilityToFile, LTwain::GetCapabilityFromFile, LTwain::GetNumOfCapsInFile, LTwain::TemplateDlg, LTwain::InitSession, LTwain::EndSession.
Topics: | Handling Template Files
 | TWAIN Functionality: Template File Functions.

Example

For an example, refer to LTwain::AddCapabilityToFile.


LTwain::CreateNumericContainerArray

#include "ltwrappr.h"

virtual L_INT LTwain::CreateNumericContainerArray (pCapability, Type, uNumOfItems, pData)

TW_CAPABILITY * pCapability; | /* pointer to a structure */
LTWAINNUMERICTYPE Type; | /* container type */
L_UINT32 uNumOfItems; | /* number of items in the array */
L_VOID * pData; | /* pointer to an allocated array */

Allocates the hContainer member of the TW_CAPABILITY structure to be type TW_ARRAY and fills it with the appropriate data.

Parameter | Description
pCapability | Pointer to a structure that contains the capability container to allocate as type TW_ARRAY.
Type | Type of data contained in the TW_ARRAY container. For a list of possible values, refer to LTWAINNUMERICTYPE.
uNumOfItems | Number of items in the array.
pData | Pointer to an allocated array of type TW_ARRAY that has been initialized with the appropriate data and size information.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

When enumerating and getting capabilities, the toolkit takes care of creating the necessary TW_CAPABILITY containers. However, if the user wants to set a capability using the LTwain::SetCapability function, he or she must declare a TW_CAPABILITY container of the appropriate type (TW_ARRAY, TW_ENUMERATION, TW_RANGE, or TW_ONEVALUE).

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::FreeContainer, LTwain::CreateNumericContainerRange, LTwain::CreateNumericContainerOneValue, LTwain::CreateNumericContainerEnum, LTwain::LockContainer, LTwain::UnlockContainer.
Topics: | How to Work with the Containers
 | TWAIN Functionality: Container Functions.

Example

// initialize session and call this function
void MyFunction(LTwain *MyClass)
{
TW_CAPABILITY twCap;
L_INT nItem[3];

L_CHAR * pData = (L_CHAR *) GlobalAllocPtr (GHND, 10 * sizeof(L_CHAR));

memset (&twCap, 0, sizeof(TW_CAPABILITY));

twCap.Cap = ICAP_FILTER;
twCap.ConType = TWON_ARRAY;

nItem[0] = TWFT_RED;
nItem[1] = TWFT_GREEN;
nItem[2] = TWFT_BLUE;

MyClass->CreateNumericContainerArray(&twCap, TWAINNUMERICTYPE_TW_UINT32, 3, (L_VOID *)nItem);

MyClass->SetCapability(&twCap, LTWAIN_CAPABILITY_SET);
MyClass->FreeContainer(&twCap);
}


LTwain::CreateNumericContainerEnum

#include "ltwrappr.h"

virtual L_INT LTwain::CreateNumericContainerEnum (pCapability, Type, uNumOfItems, uCurrentIndex, uDefaultIndex, pData)

TW_CAPABILITY * pCapability; | /* pointer to a structure */
LTWAINNUMERICTYPE Type; | /* container type */
L_UINT32 uNumOfItems; | /* number of enumeration items */
L_UINT32 uCurrentIndex; | /* current index */
L_UINT32 uDefaultIndex; | /* default index */
L_VOID * pData; | /* pointer to an allocated array */

Allocates the hContainer member of the TW_CAPABILITY structure to be type TW_ENUMERATION and fills it with the appropriate data.

Parameter | Description
pCapability | Pointer to a structure that contains the capability container to allocate as type TW_ENUMERATION.
Type | Type of data contained in the TW_ENUMERATION container. For a list of possible values, refer to LTWAINNUMERICTYPE.
uNumOfItems | Number of items in the enumeration.
uCurrentIndex | Index of the current value in the enumeration data.
uDefualtIndex | Index of the default value in the enumeration data.
pData | Pointer to an allocated array of type TW_ENUMERATION that has been initialized with the appropriate data and size information.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

When enumerating and getting capabilities, the toolkit takes care of creating the necessary TW_CAPABILITY containers. However, if the user wants to set a capability using the LTwain::SetCapability function, he or she must declare a TW_CAPABILITY container of the appropriate type (TW_ARRAY, TW_ENUMERATION, TW_RANGE, or TW_ONEVALUE).

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::FreeContainer, LTwain::CreateNumericContainerRange, LTwain::CreateNumericContainerOneValue, LTwain::CreateNumericContainerArray, LTwain::LockContainer, LTwain::UnlockContainer.
Topics: | How to Work with the Containers
 | TWAIN Functionality: Container Functions.

Example

// initialize session and call this function
void MyFunction(LTwain *MyClass)
{
TW_CAPABILITY twCap;
L_UINT16 uItem[3];

memset (&twCap, 0, sizeof(TW_CAPABILITY));

twCap.Cap = ICAP_XFERMECH;
twCap.ConType = TWON_ENUMERATION;

uItem[0] = TWSX_FILE;
uItem[1] = TWSX_MEMORY;
uItem[2] = TWSX_NATIVE;

MyClass->CreateNumericContainerEnum(&twCap, TWAINNUMERICTYPE_TW_UINT32, 3, TWSX_MEMORY, TWSX_NATIVE, (L_VOID *)uItem);

MyClass->SetCapability (&twCap, LTWAIN_CAPABILITY_SET);
MyClass->FreeContainer(&twCap);
}


LTwain::CreateNumericContainerOneValue

#include "ltwrappr.h"

virtual L_INT LTwain::CreateNumericContainerOneValue (pCapability, Type, uValue)

TW_CAPABILITY * pCapability; | /* pointer to a structure */
LTWAINNUMERICTYPE Type; | /* container type */
L_UINT32 uValue; | /* TW_ONEVALUE value */

Allocates the hContainer member of the TW_CAPABILITY structure to be type TW_ONEVALUE and fills it with the appropriate data.

Parameter | Description
pCapability | Pointer to a structure that contains the capability container to allocate as type TW_ONEVALUE.
Type | Type of data contained in the TW_ONEVALUE container. For a list of possible values, refer to LTWAINNUMERICTYPE.
uValue | Value of the TW_ONEVALUE structure.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

When enumerating and getting capabilities, the toolkit takes care of creating the necessary TW_CAPABILITY containers. However, if the user wants to set a capability using the LTwain::SetCapability function, he or she must declare a TW_CAPABILITY container of the appropriate type (TW_ARRAY, TW_ENUMERATION, TW_RANGE, or TW_ONEVALUE).

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::FreeContainer, LTwain::CreateNumericContainerRange, LTwain::CreateNumericContainerEnum, LTwain::CreateNumericContainerArray, LTwain::LockContainer, LTwain::UnlockContainer.
Topics: | How to Work with the Containers
 | TWAIN Functionality: Container Functions.

Example

For an example, refer to LTwain::Acquire.


LTwain::CreateNumericContainerRange

#include "ltwrappr.h"

virtual L_INT LTwain::CreateNumericContainerRange (pCapability, Type, uMinValue, uMaxValue, uStepSize, uDefaultValue, uCurrentValue)

TW_CAPABILITY * pCapability; | /* pointer to a structure */
LTWAINNUMERICTYPE Type; | /* container type */
L_UINT32 uMinValue; | /* minimum range value */
L_UINT32 uMaxValue; | /* maximum range value */
L_UINT32 uStepSize; | /* step size of the range */
L_UINT32 uDefaultValue; | /* range default value */
L_UINT32 uCurrentValue; | /* range current value */

Allocates the hContainer member of the TW_CAPABILITY structure to be type TW_RANGE and fills it with the appropriate data.

Parameter | Description
pCapability | Pointer to a structure that contains the capability container to allocate as type TW_RANGE.
Type | Type of data contained in the TW_RANGE container. For a list of possible values, refer to LTWAINNUMERICTYPE.
uMinValue | The minimum value of the range.
uMaxValue | The maximum value of the range.
uStepSize | The step size value of the range.
uDefaultValue | The default value of the range.
uCurrentValue | The current value of the range.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

When enumerating and getting capabilities, the toolkit takes care of creating the necessary TW_CAPABILITY containers. However, if the user wants to set a capability using the LTwain::SetCapability function, he or she must declare a TW_CAPABILITY container of the appropriate type (TW_ARRAY, TW_ENUMERATION, TW_RANGE, or TW_ONEVALUE).

The step size is the amount of increase from one step to the next within the range uMinVal to uMaxVal. For example, if uMinValue = 0, uMaxValue = 100, and uStepSize = 2, then it will take 50 steps to increase from 0 to 100.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::FreeContainer, LTwain::CreateNumericContainerOneValue, LTwain::CreateNumericContainerEnum, LTwain::CreateNumericContainerArray, LTwain::LockContainer, LTwain::UnlockContainer.
Topics: | How to Work with the Containers
 | TWAIN Functionality: Container Functions.

Example

// initialize session and call this function
void MyTestFunction(LTwain *MyClass)
{
TW_CAPABILITY twCap;

memset (&twCap, 0, sizeof(TW_CAPABILITY));

twCap.Cap = ICAP_XRESOLUTION;
twCap.ConType = TWON_RANGE;

MyClass->CreateNumericContainerRange(&twCap, TWAINNUMERICTYPE_TW_FIX32, 0, 100, 2, 50, 60);

MyClass->SetCapability(&twCap, LTWAIN_CAPABILITY_SET);
MyClass->FreeContainer(&twCap);
}


LTwain::EnableDuplex

#include "ltwrappr.h"

L_INT LTwain::EnableDuplex (bEnableDuplex)

L_BOOL bEnableDuplex;

/* flag */

Enables or disables the duplex mode.

Parameter | Description
bEnableDuplex | Flag that indicates whether to enable or disable the duplex mode. Possible values are:
 | Value | Meaning
 | TRUE | Enables the duplex mode.
 | FALSE | Disables the duplex mode.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function internally sets the duplex enabled capability CAP_DUPLEXENABLED. For more information on these capabilities, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

To get the current values of this capability, call the LTwain::GetDuplexOptions function.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::ShowProgress, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

void TestDuplexOptions(LTwain * plTwain)
{
L_BOOL bEnableDuplex;
L_INT nDuplexMode;
plTwain->GetDuplexOptions(&bEnableDuplex, &nDuplexMode);
if (bEnableDuplex != TRUE)
plTwain->EnableDuplex(TRUE);

L_INT nMaxXfer;
plTwain->GetMaxXferCount (&nMaxXfer);
if (nMaxXfer != 10)
plTwain->SetMaxXferCount (10);
}


LTwain::EndSession

#include "ltwrappr.h"

virtual L_INT LTwain::EndSession ()

Ends a TWAIN session for the object.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

A TWAIN session is started by calling the LTwain::InitSession function.

For each call to LTwain::InitSession there must be a call to LTwain::EndSession. This function should be the last function to be called in the toolkit. It will clean up and free memory allocated during the TWAIN session.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::InitSession.
Topics: | Freeing the TWAIN Session
 | TWAIN Functionality: Session Functions.

Example

For an example, refer to LTwain::IsAvailable.


LTwain::EnumCapabilities

#include "ltwrappr.h"

virtual L_INT LTwain::EnumCapabilities (uFlags)

L_UINT uFlags;

/* optional flags */

Gets the supported capabilities and specified value(s) of each capability.

Parameter | Description
uFlags | Flags that indicate the capability values to get when enumerating the TWAIN capability. Possible values are:
 | Value | Meaning
 | LTWAIN_CAPABILITY_DONTGET | [0] Get no capability values.
 | LTWAIN_CAPABILITY_GETCURRENT | [3] Get the current capability value.
 | LTWAIN_CAPABILITY_GETDEFAULT | [4] Get the default capability value.
 | LTWAIN_CAPABILITY_GETVALUES | [5] Get all available capability values.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetProperties, LTwain::GetProperties, LTwain::SetCapability, LTwain::GetCapability, LTwain::InitSession, LTwain::EndSession.
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions.

Example

For an example, refer to LTwain::AddCapabilityToFile.


LTwain::FindFastConfig

#include "ltwrappr.h"

virtual L_INT LTwain::FindFastConfig(pszWorkingFolder, uFlags, nBitsPerPixel, nBufferIteration, pInFastConfigs, nInFastConfigsCount, ppTestConfigs, pnTestConfigsCount, pOutBestConfig, uStructSize)

L_TCHAR L_FAR * pszWorkingFolder; | /* working folder path */
L_UINT uFlags; | /* option flags */
L_INT nBitsPerPixel; | /* bits per pixel */
L_INT nBufferIteration; | /* buffer iteration count */
pFASTCONFIG pInFastConfigs; | /* pointer to a structure */
L_INT nInFastConfigsCount; | /* number of array elements */
pFASTCONFIG *ppTestConfigs; | /* pointer to a pointer to a structure */
L_INT *pnTestConfigsCount; | /* number of scan configurations tested */
pFASTCONFIG pOutBestConfig; | /* pointer to a structure */
L_UINT uStructSize; | /* size of the FASTCONFIG structure*/

Determines the best scanner configuration. This function is available in the Document/Medical Toolkits.

Parameter | Description
pszWorkingFolder | Character string containing the path to the working folder in which to save the tested images.
uFlags | Flags that control the display of the user interface and the actions of the function. Possible values are:
 | Value | Meaning
 | LTWAIN_SHOW_USER_INTERFACE | [0x0001] Shows the manufacturer's user interface as modeless.
 | LTWAIN_MODAL_USER_INTERFACE | [0x0002] Shows the manufacturer's user interface as a modal dialog. Works only if the LTWAIN_SHOW_USER_INTERFACE flag is set.
 | LTWAIN_USE_THREAD_MODE | [0x0008] Use the fast Thread mode.
 | LTWAIN_CHECK_ALL_DEFAULT_BPP | [0x0010] Test all supported BPP.
nBitsPerPixel | Resulting file's pixel depth. Note that not all bits per pixel are available to all file formats. For valid values, refer to Formats of Output Files . If nBitsPerPixel is 0, the file will be stored using the closest BitsPerPixel value supported by that format.
nBufferIteration | This value is used to determine the number of memory configurations that will be tested. The maximum value for this parameter is 10.
pInFastConfigs | Pointer to a FASTCONFIG structure that contains an array of scan configurations to be tested. Pass NULL to test the default scan configurations
nInFastConfigsCount | Number of scan configurations referenced in pInFastConfigs. Pass 0 to test the default scan configurations.
ppTestConfigs | Address of a pointer to a FASTCONFIG structure. The function will automatically allocate an array of FASTCONFIG structures using the total number of tested configurations.
pnTestConfigsCount | Pointer to an integer variable to be updated with number of tested configurations.
pOutBestConfig | Pointer to a FASTCONFIG structure to be updated with the best configuration for the scanner.
uStructSize | Specifies the size of the FASTCONFIG structure in bytes, for versioning. Use sizeof(FASTCONFIG).

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function will test scan configurations for the scanner selected by calling LTwain::SelectSource. It will update the pOutBestConfig parameter with the best scan configuration tested. Once the best scan configuration has been determined, the scan configuration's values for the transfer mode, bits per pixel, format and buffer size can be passed to LTwain::AcquireMulti so the images can be scanned as fast as possible.

To test user-defined/custom configurations, pass these configurations in pInFastConfigs and the number of configurations in nInFastConfigsCount.

To test the default configurations available for the Twain driver, pass NULL for pInFastConfigs and 0 for nInFastConfigsCount. In this case, the function will test scan configurations based the values passed in the nBitsPerPixel and nBufferIteration parameters.

The list of default scan configurations to test can be shortened by using the LTwain::GetScanConfigs function to get a list of default scan configurations based on transfer mode, bits per pixel and number of buffers. This list can then be passed to LTwain::FindFastConfig function to determine the best and fastest scan configuration.

If LTWAIN_CHECK_ALL_DEFAULT_BPP is set in uFlags then the function will test all supported bits per pixel for the selected scanner. If this flag is not set in uFlags, then the function will use the iBitsPerPixel parameter value.

If LTWAIN_USE_THREAD_MODE is set in uFlags, then the image acquisition process will run in thread mode. In some scanners, acquiring images in thread will improve the speed at which the image(s) is(are) acquired. In other scanners, high-speed scanners, for example, acquiring the image(s) in thread mode will provide little to no improvement in the speed at which the image(s) is(are) acquired.

The nBitsPerPixel parameter and LTWAIN_CHECK_ALL_DEFAULT_BPP flag will be used only if the transfer mode for the scan configuration being tested is LTWAIN_BUFFER_MODE or LTWAIN_NATIVE_MODE.

The nBufferIteration parameter will be used only if the transfer mode for the scan configuration being tested is LTWAIN_BUFFER_MODE.

If you override the LTwain::FindFastConfigCallBack function, the scan configuration testing process can be stopped by returning any value other than SUCCESS for the callback function. The testing process is continued by returning SUCCESS for the callback function.

This function allocates storage for the array of scan configurations in ppTestConfigs. When this storage is no longer needed, you must free the storage by calling LTwain::FreeScanConfig.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::FindFastConfigCallBack, LTwain::Acquire, LTwain::AcquireList, LTwain::InitSession, LTwain::EndSession, LTwain::OpenTemplateFile, LTwain::CloseTemplateFile, LTwain::TemplateDlg, LTwain::AddCapabilityToFile, LTwain::GetNumofCapsInFile, LTwain::GetCapabilityFromFile, LTwain::AcquireMulti, LTwain::GetScanConfigs, LTwain::FreeScanConfig.
Topics: | Fast TWAIN (Scan Configurations)
 | TWAIN Functionality: Fast TWAIN (Scan Configuration) Functions.

Example

class CMyTwain : public LTwain
{
public:
L_INT FindFastConfigCallBack(pFASTCONFIG pResConfig);
};

// initialize session by LTwain::InitSession and call this function
L_INT CMyTwain::FindFastConfigCallBack(pFASTCONFIG pResConfig)
{
L_TCHAR szBuffer[MAX_PATH];
if (pResConfig->bSuccess)
{
memset(szBuffer, 0, sizeof(szBuffer));
wsprintf(szBuffer, TEXT("Transfer Mode = %d\nFile Format = %d\nBuffer Size = %d\nRequired Time = %d\n"),
pResConfig->uTransferMode,
pResConfig->nFileFormat,
pResConfig->ulBufferSize,
pResConfig->uTime);

MessageBox(NULL, szBuffer, TEXT("Result Scan Configuration..."), MB_OK);
}
else
MessageBox(NULL, TEXT("The tested configuration failed"), TEXT("Error!"), MB_OK);
return SUCCESS;
}

L_INT TestScanConfig(HWND hWnd, CMyTwain *MyClass)
{
L_INT       nRet;
pFASTCONFIG pTestConfigs = NULL;
L_INT       nTestConfigsCount = 0;
pFASTCONFIG pFastConfig=NULL;
L_INT       nFastConfigCount;
FASTCONFIG  BestConfig;
L_TCHAR      szBuffer[MAX_PATH];
MyClass->EnableCallBack
 (TRUE);
nRet = MyClass->GetScanConfigs (1, LTWAIN_BUFFER_MODE, 5, &pFastConfig, sizeof(FASTCONFIG), &nFastConfigCount);
if (nRet != SUCCESS)
{
MessageBox(hWnd, TEXT("Error occurred while getting the scan configurations for the Memory transfer mode!!!"), TEXT("Error!!!"), MB_OK);
return nRet;
}

memset(&BestConfig, 0, sizeof(FASTCONFIG));

nRet = MyClass->FindFastConfig(TEXT("c:\\TWAIN"),
LTWAIN_SHOW_USER_INTERFACE,
1,
5,
pFastConfig, nFastConfigCount,
&pTestConfigs,
&nTestConfigsCount,
&BestConfig, sizeof(FASTCONFIG));

if (nRet == SUCCESS)
{
MessageBox(hWnd, TEXT("LTwain::FindFastConfig function was successful."), TEXT("Notice"), MB_OK);

memset(szBuffer, 0, sizeof(szBuffer));
wsprintf(szBuffer, TEXT("Transfer Mode = %d\nFile Format = %d\nBuffer Size = %d\nRequired Time = %d\n"),
BestConfig.uTransferMode,
BestConfig.nFileFormat,
BestConfig.ulBufferSize,
BestConfig.uTime);

MessageBox(hWnd, szBuffer, TEXT("Best Scan Configuration..."), MB_OK);

MyClass->FreeScanConfig(&pTestConfigs, nTestConfigsCount);
}
else
MessageBox(hWnd, TEXT("Error occurred in the L_TwainFindFastConfig function!!!"), TEXT("Error!!!"), MB_OK);

MyClass->FreeScanConfig(&pFastConfig, nFastConfigCount);
return nRet;
}


LTwain::FindFastConfigCallBack

#include "ltwrappr.h"

virtual L_INT FindFastConfigCallBack(pResConfig)

pFASTCONFIG pResConfig;

/* pointer to a FASTCONFIG structure */

Called for each configuration test performed by the LTwain::FindFastConfig function. This function is available in the Document/Medical Toolkits.

Parameter | Description
pResConfig | Pointer to a FASTCONFIG structure that contains the scan configuration that is currently being tested.

Returns

SUCCESS | The function was successful.
SUCCESS_ABORT | Abort the testing configuration.

Comments

This callback function will be enabled only if you enabled the callback functions by calling LBase::EnableCallBack (TRUE).

If SUCCESS is returned, then the scan configuration testing process will be continued, otherwise, the process will be stopped.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::Acquire, LTwain::AcquireList, LTwain::InitSession, LTwain::EndSession, LTwain::OpenTemplateFile, LTwain::CloseTemplateFile, LTwain::TemplateDlg, LTwain::AddCapabilityToFile, LTwain::GetNumofCapsInFile, LTwain::GetCapabilityFromFile, LTwain::AcquireMulti, LTwain::FindFastConfig, LTwain::GetScanConfigs, LTwain::FreeScanConfig
Topics: | Fast Twain (Scan Configurations)
 | TWAIN Functionality: Scan Configuration Functions.

Example

For an example, refer to LTwain::FindFastConfig.


LTwain::FreeContainer

#include "ltwrappr.h"

virtual L_INT LTwain::FreeContainer (pCapability)

TW_CAPABILITY * pCapability;

/* pointer to a structure */

Frees the container of the specified structure.

Parameter | Description
pCapability | Pointer to a structure that contains the capability container to free.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The container in the TW_CAPABILITY structure will be internally freed.

This is a container that was allocated by one of the following functions:

LTwain::CreateNumericContainerOneValue

LTwain::CreateNumericContainerArray

LTwain::CreateNumericContainerEnum

LTwain::CreateNumericContainerRange

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::CreateNumericContainerOneValue, LTwain::CreateNumericContainerArray, LTwain::CreateNumericContainerEnum, LTwain::CreateNumericContainerRange.
Topics: | How to Work with the Containers
 | TWAIN Functionality: Container Functions.

Example

For an example, refer to LTwain::Acquire.


LTwain::FreeExtendedImageInfoStructure

#include "ltwrappr.h"

virtual L_INT LTwain::FreeExtendedImageInfoStructure (pptwExtImgInfo)

TW_EXTIMAGEINFO ** pptwExtImgInfo;

/* pointer to a pointer to a structure*/

Frees the TW_EXTIMAGEINFO structure.

Parameter | Description
pptwExtImgInfo | Pointer to a pointer to the TW_EXTIMAGEINFO structure to be freed.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function will free the TW_EXTIMAGEINFO structure allocated by the LTwain::GetExtendedImageInfo function.

For more information on extended image information, refer to the Twain 1.9 Specification, available at www.twain.org.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::GetExtendedImageInfo.
Topics: | How to Acquire from the TWAIN Source
 | TWAIN Functionality: Extended Image Information Functions.

Example

For an example, refer to LTwain::GetExtendedImageInfo.


LTwain::FreePropQueryStructure

#include "ltwrappr.h"

virtual L_INT LTwain::FreePropQueryStructure (ppltProperty)

pLTWAINPROPERTYQUERY * ppltProperty;

/* pointer to a pointer to a structure */

Frees the pointer to the specified structure.

Parameter | Description
ppltProperty | Pointer to a pointer to a LTWAINPROPERTYQUERY structure to free.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

ppltProperty parameter was allocated by the calling the LTwain::QueryProperty function.

The ppltProperty parameter will be internally freed.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::QueryProperty.
Topics: | How to Work with the Containers
 | TWAIN Functionality: Property Functions.

Example

For an example, refer to LTwain::QueryProperty.


LTwain::FreeScanConfig

#include "ltwrappr.h"

virtual L_INT LTwain::FreeScanConfig(ppFastConfig, nFastConfigCount)

pFASTCONFIG *ppFastConfig; | /* address of a pointer to a FASTCONFIG structure */
L_INT nFastConfigCount; | /* number of array elements */

Frees storage allocated for a scan configuration array. This function is available in the Document/Medical Toolkits.

Parameter | Description
ppFastConfig | Address of the pointer to the array of FASTCONFIG structures. This function will free the array of FASTCONFIG structures allocated by LTwain::FindFastConfig and LTwain::GetScanConfigs.
nFastConfigCount | Number of array elements to free.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Call this function to free the memory allocated by the LTwain::FindFastConfig and LTwain::GetScanConfigs functions.

This function should be called when your program no longer needs the array of FASTCONFIG structures.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::Acquire, LTwain::AcquireList, LTwain::InitSession, LTwain::EndSession, LTwain::OpenTemplateFile, LTwain::CloseTemplateFile, LTwain::TemplateDlg, LTwain::AddCapabilityToFile, LTwain::GetNumofCapsInFile, LTwain::GetCapabilityFromFile, LTwain::AcquireMulti, LTwain::FindFastConfig, LTwain::GetScanConfigs
Topics: | Fast TWAIN (Scan Configurations)
 | TWAIN Functionality: Fast TWAIN (Scan Configuration) Functions.

Example

For an example, refer to LTwain::FindFastConfig.


LTwain::GetAcquirePageOptions

#include "ltwrappr.h"

L_INT LTwain::GetAcquirePageOptions (pnPaperSize, pnPaperDirection);

L_INT * pnPaperSize; | /* pointer to a variable */
L_INT * pnPaperDirection; | /* pointer to a variable */

Gets the current page size, and page orientation values used when transferring images from the current TWAIN source.

Parameter | Description
pnPaperSize | Pointer to a variable to be updated with the page size. For more information on possible values, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).
pnPaperDirection | Pointer to a variable to be updated with the page direction. For more information on possible values, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function gets the current page size capability ICAP_SUPPORTEDSIZES, and page orientation capability ICAP_ORIENTATION values. For more information on these capabilities, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

To set these capabilities, call the LTwain::SetAcquirePageOptions function.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

For an example, refer to LTwain::GetImageEffects.


LTwain::GetCapability

#include "ltwrappr.h"

virtual L_INT LTwain::GetCapability (pCapability, uFlags)

pTW_CAPABILITY pCapability; | /* pointer to a structure */
L_UINT uFlags; | /* optional flags */

Gets the specified capability value(s).

Parameter | Description
pCapability | Pointer to a TW_CAPABILITY structure that references the required capability. This structure must be allocated and it will be filled with data corresponding to the required capability to get.
uFlags | Flags that indicate the capability values to get. Possible values are:
 | Value | Meaning
 | LTWAIN_CAPABILITY_GETCURRENT | [3] Get the current value.
 | LTWAIN_CAPABILITY_GETDEFAULT | [4] Get the default value.
 | LTWAIN_CAPABILITY_GETVALUES | [5] Get all available values.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Function: | LTwain::SetProperties, LTwain::GetProperties, LTwain::SetCapability, LTwain::InitSession, LTwain::EndSession.
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions.

Example

class CMyTwain : public LTwain

{

//Create class here

};

// initialize session and call this function
void GetCapability(CMyTwain *MyClass)
{
L_INT nRet;
TW_CAPABILITY twCap;

// Fill the TW_CAPABILITY structure with values
twCap.Cap = ICAP_XFERMECH;
twCap.ConType = TWON_DONTCARE16;
nRet = MyClass->GetCapability(&twCap, LTWAIN_CAPABILITY_GETCURRENT);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability"), TEXT("ERROR"), MB_OK);
return;
}
MyClass->FreeContainer(&twCap);
}


LTwain::GetCapabilityFromFile

#include "ltwrappr.h"

virtual L_INT LTwain::GetCapabilityFromFile (hFile, ppCapability, uIndex)

HTWAINTEMPLATEFILE hFile; | /* handle to an existing template file */
pTW_CAPABILITY * ppCapability; | /* pointer to a pointer to a structure */
L_UINT uIndex; | /* capability index */

Gets the capability, at the specified index, in the specified file.

Parameter | Description
hFile | Handle to an existing template file.
ppCapability | Pointer to a pointer to a TW_CAPABILITY structure. This structure will be allocated internally.
uIndex | Index of the capability to get from the file. This is a zero-based index.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

To get a capability stored in a file; the file must be opened for reading by calling LTwain::OpenTemplateFile function. The user must declare a variable of type pTW_CAPABILITY and pass the address of this to the function. This parameter will be updated with a pointer to the capability at the specified index.

Note:

If the function is successful, the user must:

Free the container of the TW_CAPABILITY structure by a calling LTwain::FreeContainer function.

Free the value referenced by the contents of the pptwCapability using GlobalUnlock and GlobalFree.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::OpenTemplateFile, LTwain::AddCapabilityToFile, LTwain::TemplateDlg, LTwain::GetNumOfCapsInFile, LTwain::CloseTemplateFile, LTwain::InitSession, LTwain::EndSession.
Topics: | Handling Template Files
 | TWAIN Functionality: Capability Functions.

Example

class CMyTwain : public LTwain

{

//Create class here

};

// initialize session and call this function
void TestGetCapabilityFromFile(CMyTwain *MyClass, HWND hWndParent)
{
OPENFILENAME ofn;
L_INT nRet;
HTWAINTEMPLATEFILE hFile;
L_TCHAR szFilePath [MAX_PATH];

memset (&ofn, 0, sizeof(OPENFILENAME));
memset (szFilePath, 0, MAX_PATH);

ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hWndParent;
ofn.lpstrFile = szFilePath;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrTitle = TEXT("Load Template File");

if (GetOpenFileName (&ofn))
{
nRet = MyClass->OpenTemplateFile(&hFile, szFilePath, LTWAIN_TEMPLATE_OPEN_READ);

if (nRet == SUCCESS)
{
L_UINT uIndex, uCapCount = 0;
pTW_CAPABILITY ptwCapability = NULL;
uCapCount = MyClass->GetNumOfCapsInFile(hFile);

if (uCapCount > 0)
{
for (uIndex = 0 ; uIndex < uCapCount ; uIndex ++)
{
nRet = MyClass->GetCapabilityFromFile(hFile, &ptwCapability, uIndex);

if (nRet == SUCCESS)
{
nRet = MyClass->SetCapability(ptwCapability, LTWAIN_CAPABILITY_SET);
}

if (ptwCapability)
{
GlobalFree (ptwCapability->hContainer);
GlobalFreePtr (ptwCapability);
}
}
}
MyClass->CloseTemplateFile(hFile);
}
}
}


LTwain::GetDuplexOptions

#include "ltwrappr.h"

L_INT LTwain::GetDuplexOptions (pbEnableDuplex, pnDuplexMode)

L_BOOL * pbEnableDuplex; | /* pointer to a variable to be updated */
L_INT * pnDuplexMode; | /* pointer to the duplex mode */

Gets the current duplex mode and the enabled status of the current duplex mode for the current TWAIN source.

Parameter | Description
pbEnableDuplex | Pointer to a variable to be updated with a value that specifies whether the duplex mode is enabled or disabled. Possible values are:
 | Value | Meaning
 | TRUE | Duplex mode is enabled.
 | FALSE | Duplex mode is disabled.
pnDuplexMode | Pointer to a variable to be updated with the duplex mode value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function gets the current duplex mode capability CAP_DUPLEX, and the duplex mode's enabled status capability CAP_DUPLEXENABLED values. For more information on these capabilities, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

To enable or disable the duplex mode, call the LTwain::EnableDuplex function.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

For an example, refer to LTwain::EnableDuplex.


LTwain::GetExtendedImageInfo

#include "ltwrappr.h"

virtual L_INT LTwain::GetExtendedImageInfo(ptwExtImgInfo)

TW_EXTIMAGEINFO * ptwExtImgInfo;

/* pointer to a structure */

Gets the extended image information related to the image acquired by the LTwain::Acquire function.

Parameter | Description
ptwExtImgInfo | Pointer to a TW_EXTIMAGEINFO structure that references extended image info to fill.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function can only be called during the LTwain::BitmapCallBack function, called by the LTwain::Acquire function, and only after a page has been acquired from a TWAIN source.

Extended image information can be Barcode texts, Barcode data, etc. For more information on extended image information, refer to the Twain 1.9 Specification, available at www.twain.org.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::Acquire, LTwain::BitmapCallBack, LTwain::InitSession, LTwain::EndSession.
Topics: | How to Acquire from the TWAIN Source
 | TWAIN Functionality: Extended Image Information Functions.

Example

class CMyTwain : public LTwain
{
public:
L_INT BitmapCallBack(pBITMAPHANDLE pBitmap);
};

// This function will be called if you call LTwain::Acquire function
L_INT CMyTwain::BitmapCallBack(pBITMAPHANDLE pBitmap)
{
L_INT nRet = SUCCESS;
TW_EXTIMAGEINFO * pExtImg = NULL;

pExtImg = (TW_EXTIMAGEINFO *)GlobalAllocPtr (GHND, sizeof (TW_EXTIMAGEINFO) + sizeof(TW_INFO));
if (pExtImg)
{
pExtImg->NumInfos = 2;
pExtImg->Info[1].InfoID = TWEI_BARCODECOUNT;
pExtImg->Info[1].ItemType = TWTY_UINT32;
pExtImg->Info[1].InfoID = TWEI_BARCODETYPE;
pExtImg->Info[1].ItemType = TWTY_UINT32;

if (GetExtendedImageInfo (pExtImg) == SUCCESS)
{
// Do processing to returned values
FreeExtendedImageInfoStructure(&pExtImg);
}

GlobalFreePtr (pExtImg);
}

return nRet;

}


LTwain::GetImageBitsPerPixel

#include "ltwrappr.h"

L_INT LTwain::GetImageBitsPerPixel (pnBitsPerPixel);

L_INT * pnBitsPerPixel;

/* pointer to the bits per pixel */

Gets the current bits per pixel value used when transferring images from the current TWAIN source.

Parameter | Description
pnBitsPerPixel | Pointer to a variable to be updated with the number of bits per pixel. For more information on possible values, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function gets the bits per pixel capability ICAP_BITDEPTH. For more information on this capability, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

To set the bits per pixel capability, call the LTwain::SetImageBitsPerPixel function.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

For an example, refer to LTwain::SetImageUnit.


LTwain::GetImageEffects

#include "ltwrappr.h"

L_INT LTwain::GetImageEffects (ulFlags, pBrightness, pContrast, pHighlight)

L_UINT32 ulFlags; | /* optional flags */
pTW_FIX32 pBrightness; | /* pointer to a variable */
pTW_FIX32 pContrast; | /* pointer to a variable */
pTW_FIX32 pHighlight; | /* pointer to a variable */

Gets the current brightness, highlight and contrast values used when transferring images from the current TWAIN source.

Parameter | Description
ulFlags | Flags that indicate which capability values to get. Possible values are:
 | Value | Meaning
 | TWAIN_NEGOTIATE_BRIGHTNESS | [0x0010] Gets the brightness capability value.
 | TWAIN_NEGOTIATE_CONTRAST | [0x0020] Gets the contrast capability value.
 | TWAIN_NEGOTIATE_HIGHLIGHT | [0x0040] Gets the highlight capability value.
pBrightness | Pointer to a variable to be updated with the current brightness capability value. For more information on possible values, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).
pContrast | Pointer to a variable to be updated with the current contrast capability value. For more information on possible values, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).
pHighlight | Pointer to a variable to be updated with the current highlight capability value. For more information on possible values, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function gets the current brightness capability ICAP_BRIGHTNESS, highlight capability ICAP_HIGHLIGHT, and contrast capability ICAP_CONTRAST values. For more information on these capabilities, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

To set these capabilities, call the LTwain::SetImageEffects function.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

For an example, refer to LTwain::GetImageEffects.


LTwain::GetImageFrame

#include "ltwrappr.h"

L_INT LTwain::GetImageFrame (pFrame);

pTW_FRAME pFrame;

/* pointer to a structure */

Gets the current image frame used to transfer images from the current TWAIN source.

Parameter | Description
pFrame | Pointer to a structure to be updated with the current image frame.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The image frame specifies the size and location of the image to acquire. To set the image frame for the current TWAIN source, call the LTwain::SetImageFrame function.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

For an example, refer to LTwain::SetImageFrame.


LTwain::GetImageUnit

#include "ltwrappr.h"

L_INT LTwain::GetImageUnit (pnUnit);

L_INT * pnUnit;

/* pointer to a variable */

Gets the current image unit value used when transferring images from the current TWAIN source.

Parameter | Description
pnUnit | Pointer to a variable to be updated with the current image unit value. For more information on possible values, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function gets the value of the image unit capability ICAP_UNITS. For more information on this capability, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

To set the image unit capability value, call the LTwain::SetImageUnit function

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

For an example, refer to LTwain::SetImageUnit.


LTwain::GetJPEGCompression

#include "ltwrappr.h"

L_INT LTwain::GetJPEGCompression (pTwJpegComp, uFlag);

pTW_JPEGCOMPRESSION pTwJpegComp; | /* pointer to a structure */
L_UINT uFlag; | /* flag */

Gets the current or default JPEG compression settings for the session.

Parameter | Description
pTwJpegComp | Pointer to a TW_JPEGCOMPRESSION structure to be updated with the JPEG compression settings.
uFlag | Flag that indicates which type of JPEG compression values to get. Possible values are:
 | Value | Meaning
 | LTWAIN_GET_JPEG_COMPRESSION | [0x0001] Get the current JPEG compression settings.
 | LTWAIN_GET_DEFAULT_JPEG_COMPRESSION | [0x0002] Get the default JPEG compression settings.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function will get the current or default TWAIN JPEG compression settings, depending on the flag passed to the uFlag parameter.

For more information about TW_JPEGCOMPRESSION, refer to the TWAIN 1.9 specification from the site "http://www.twain.org/".

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetJPEGCompression, LTwain::InitSession
Topics: | Using JPEG Compression for a TWAIN Source
 | TWAIN Functionality: JPEG Compression Functions

Example

void TestJPEGCompression(LTwain * plTwain)
{
TW_JPEGCOMPRESSION myJPEG;
memset(&myJPEG, 0, sizeof(TW_JPEGCOMPRESSION));
L_INT nRet = plTwain->GetJPEGCompression(&myJPEG, LTWAIN_GET_JPEG_COMPRESSION);
if (nRet == SUCCESS)
{
myJPEG.ColorSpace = TWPT_GRAY;
myJPEG.SubSampling = 0x10001000;
myJPEG.NumComponents = 1;
myJPEG.RestartFrequency = 0;
myJPEG.QuantMap[0] = 0;
memset(&myJPEG.QuantTable[0], 0, sizeof(TW_MEMORY));
myJPEG.HuffmanMap[0] = 0;
memset(&myJPEG.HuffmanDC[0], 0, sizeof(TW_MEMORY));
memset(&myJPEG.HuffmanAC[0], 0, sizeof(TW_MEMORY));

nRet = plTwain->SetJPEGCompression (&myJPEG, LTWAIN_SET_JPEG_COMPRESSION);
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("Set JPEG compression options is success"), ("Notice!"), MB_OK);
}
}


LTwain::GetMaxXferCount

#include "ltwrappr.h"

L_INT LTwain::GetMaxXferCount (pnMaxXferCount);

L_INT * pnMaxXferCount;

/* pointer to the transfer image count */

Gets the maximum number of images that can be transferred from the current TWAIN source.

Parameter | Description
pnMaxXferCount | Pointer to a variable to be updated with the maximum number of images that can be transferred from the current TWAIN source.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function gets the current maximum transfer count capability CAP_XFERCOUNT value. For more information on these capabilities, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

To set the maximum transfer count capability, call the LTwain::SetMaxXferCount function.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

For an example, refer to LTwain::EnableDuplex.


LTwain::GetNumericContainerBOOLValue

#include "ltwrappr.h"

virtual L_INT LTwain::GetNumericContainerBOOLValue(pCapability, nIndex, pbValue)

TW_CAPABILITY * pCapability; | /* pointer to a structure */
L_INT nIndex; | /* value’s index */
L_BOOL *pbValue; | /* pointer to a Boolean value */

Gets the specified value from a container.

Parameter | Description
pCapability | Pointer to a TW_CAPABILITY structure that references the container value to get.
nIndex | Index of the value to get. Possible values are:
 | Value | Meaning
 | LTWAIN_VALUE_COUNT | [-1] Update ppValue with the number of items in the item list of the specified container. This option is only valid if the container is of type TW_ARRAY or TW_ENUMERATION. If the container is of any other type, this function will return an error code.
 | LTWAIN_VALUE_CURRENT | [-2] Update ppValue with the current value of the container. If the container is of type TW_RANGE, ppValue is updated with the CurrentValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ppValue is updated with the CurrentIndex member of the TW_ENUMERATION structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_DEFAULT | [-3] Update ppValue with the default value of the container. If the container is of type TW_RANGE, ppValue is updated with the DefaultValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ppValue is updated with the DefaultIndex member of the TW_ENUMERATION structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_MINIMUM | [-4] Update ppValue with the minimum value of the container. If the container is of type TW_RANGE, ppValue is updated with the MinValue member of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_MAXIMUM | [-5] Update ppValue with the maximum value of the container. If the container is of type TW_RANGE, ppValue is updated with the MaxValue member of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_STEPSIZE | [-6] Update ppValue with the step size of the container. If the container is of type TW_RANGE, ppValue is updated with the StepSize membr of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | >= 0 | Update ppValue with the value at the specified index. If the container is of type TW_ONEVALUE, nIndex must be zero and ppValue will be updated with the value of the TW_ONEVALUE structure. If the container is of type TW_ARRAY or TW_ENUMERATION, ppValue will be updated with the value at the specified index in the list of items. If the container is of type TW_ENUMERATION or TW_ARRAY, the value must not exceed the number of items in the container's item list or the function will return an error code.
pbValue | Reference to a Boolean value to be updated with the specified container value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Use this function to get a value from a container's item list when the item list type is Boolean.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::GetNumericContainerItemType, LTwain::GetNumericContainerINTValue, LTwain::GetNumericContainerUINTValue, LTwain::GetNumericContainerFIX32Value, LTwain::GetNumericContainerFRAMEValue, LTwain::GetNumericContainerSTRINGValue, LTwain::GetNumericContainerUNICODEValue.
Topics: | How to Work with the Containers
 | TWAIN Functionality: Container Functions.

Example

// initialize session and call this function
void MyTestFunction(LTwain *MyClass)
{
L_INT nRet;
L_INT nItemType;
L_BOOL bValue;
TW_CAPABILITY twCap;

// Fill the TW_CAPABILITY structure with values
twCap.Cap = CAP_AUTOFEED;
twCap.ConType = TWON_ONEVALUE;
nRet = MyClass->GetCapability(&twCap, LTWAIN_CAPABILITY_GETCURRENT);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability"), TEXT("ERROR"), MB_OK);
return;
}

nRet = MyClass->GetNumericContainerItemType(&twCap, &nItemType);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability item type"), TEXT("ERROR"), MB_OK);
}
else if (nItemType == TWTY_BOOL)
{
nRet = MyClass->GetNumericContainerBOOLValue (&twCap, 0, &bValue);
if (nRet != SUCCESS)
MessageBox (NULL, TEXT("Failed to get capability item value"), TEXT("ERROR"), MB_OK);
}

}


LTwain::GetNumericContainerFIX32Value

#include "ltwrappr.h"

virtual L_INT LTwain::GetNumericContainerFIX32Value(pCapability, nIndex, ptwFix)

TW_CAPABILITY * pCapability; | /* pointer to a structure */
L_INT nIndex; | /* value's index */
TW_FIX32 *ptwFix; | /* pointer to a TW_FIX32 structure */

Gets the specified value from a container.

Parameter | Description
pCapability | Pointer to a TW_CAPABILITY structure that references the container value to get.
nIndex | Index of the value to get. Possible values are:
 | Value | Meaning
 | LTWAIN_VALUE_COUNT | [-1] Update ppValue with the number of items in the item list of the specified container. This option is only valid if the container is of type TW_ARRAY or TW_ENUMERATION. If the container is of any other type, this function will return an error code.
 | LTWAIN_VALUE_CURRENT | [-2] Update ppValue with the current value of the container. If the container is of type TW_RANGE, ppValue is updated with the CurrentValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ppValue is updated with the CurrentIndex member of the TW_ENUMERATION structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_DEFAULT | [-3] Update ppValue with the default value of the container. If the container is of type TW_RANGE, ppValue is updated with the DefaultValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ppValue is updated with the DefaultIndex member of the TW_ENUMERATION structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_MINIMUM | [-4] Update ppValue with the minimum value of the container. If the container is of type TW_RANGE, ppValue is updated with the MinValue member of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_MAXIMUM | [-5] Update ppValue with the maximum value of the container. If the container is of type TW_RANGE, ppValue is updated with the MaxValue member of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_STEPSIZE | [-6] Update ppValue with the step size of the container. If the container is of type TW_RANGE, ppValue is updated with the StepSize membr of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | >= 0 | Update ppValue with the value at the specified index. If the container is of type TW_ONEVALUE, nIndex must be zero and ppValue will be updated with the value of the TW_ONEVALUE structure. If the container is of type TW_ARRAY or TW_ENUMERATION, ppValue will be updated with the value at the specified index in the list of items. If the container is of type TW_ENUMERATION or TW_ARRAY, the value must not exceed the number of items in the container's item list or the function will return an error code.
ptwFix | Pointer to a TW_FIX32 value to be updated with the specified container value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Use this function to get a value from a container's item list when the item list type is TW_FIX32.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::GetNumericContainerItemType, LTwain::GetNumericContainerINTValue, LTwain::GetNumericContainerUINTValue, LTwain::GetNumericContainerBOOLValue, LTwain::GetNumericContainerFRAMEValue, LTwain::GetNumericContainerSTRINGValue, LTwain::GetNumericContainerUNICODEValue.
Topics: | How to Work with the Containers
 | TWAIN Functionality: Container Functions.

Example

// initialize session and call this function
void MyTestFunction(LTwain *MyClass)
{
L_INT nRet;
L_INT nItemType;
TW_FIX32 twFix;
TW_CAPABILITY twCap;

// Fill the TW_CAPABILITY structure with values
twCap.Cap = ICAP_BRIGHTNESS;
twCap.ConType = TWON_ONEVALUE;
nRet = MyClass->GetCapability(&twCap, LTWAIN_CAPABILITY_GETCURRENT);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability"), TEXT("ERROR"), MB_OK);
return;
}

nRet = MyClass->GetNumericContainerItemType(&twCap, &nItemType);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability item type"), TEXT("ERROR"), MB_OK);
}
else if (nItemType == TWTY_BOOL)
{
nRet = MyClass->GetNumericContainerFIX32Value (&twCap, 0, &twFix);
if (nRet != SUCCESS)
MessageBox (NULL, TEXT("Failed to get capability item value"), TEXT("ERROR"), MB_OK);
}
}


LTwain::GetNumericContainerFRAMEValue

#include "ltwrappr.h"

virtual L_INT LTwain::GetNumericContainerFRAMEValue(pCapability, nIndex, ptwFrame)

TW_CAPABILITY * pCapability; | /* pointer to a structure */
L_INT nIndex; | /* value's index */
TW_FRAME *ptwFrame; | /* pointer to a TW_FRAME value */

Gets the specified value from a container.

Parameter | Description
pCapability | Pointer to a TW_CAPABILITY structure that references the container value to get.
nIndex | Index of the value to get. Possible values are:
 | Value | Meaning
 | LTWAIN_VALUE_COUNT | [-1] Update ppValue with the number of items in the item list of the specified container. This option is only valid if the container is of type TW_ARRAY or TW_ENUMERATION. If the container is of any other type, this function will return an error code.
 | LTWAIN_VALUE_CURRENT | [-2] Update ppValue with the current value of the container. If the container is of type TW_RANGE, ppValue is updated with the CurrentValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ppValue is updated with the CurrentIndex member of the TW_ENUMERATION structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_DEFAULT | [-3] Update ppValue with the default value of the container. If the container is of type TW_RANGE, ppValue is updated with the DefaultValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ppValue is updated with the DefaultIndex member of the TW_ENUMERATION structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_MINIMUM | [-4] Update ppValue with the minimum value of the container. If the container is of type TW_RANGE, ppValue is updated with the MinValue member of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_MAXIMUM | [-5] Update ppValue with the maximum value of the container. If the container is of type TW_RANGE, ppValue is updated with the MaxValue member of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_STEPSIZE | [-6] Update ppValue with the step size of the container. If the container is of type TW_RANGE, ppValue is updated with the StepSize membr of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | >= 0 | Update ppValue with the value at the specified index. If the container is of type TW_ONEVALUE, nIndex must be zero and ppValue will be updated with the value of the TW_ONEVALUE structure. If the container is of type TW_ARRAY or TW_ENUMERATION, ppValue will be updated with the value at the specified index in the list of items. If the container is of type TW_ENUMERATION or TW_ARRAY, the value must not exceed the number of items in the container's item list or the function will return an error code.
twFrame | Reference to a TW_FRAME value to be updated with the specified container value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Use this function to get a value from a container's item list when the item list type is TW_FRAME.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::GetNumericContainerItemType, LTwain::GetNumericContainerINTValue, LTwain::GetNumericContainerUINTValue, LTwain::GetNumericContainerBOOLValue, LTwain::GetNumericContainerFIX32Value, LTwain::GetNumericContainerSTRINGValue, LTwain::GetNumericContainerUNICODEValue.
Topics: | How to Work with the Containers
 | TWAIN Functionality: Container Functions.

Example

// initialize session and call this function
void MyTestFunction(LTwain *MyClass)
{
L_INT nRet;
L_INT nItemType;
TW_FRAME twFrame;
TW_CAPABILITY twCap;

// Fill the TW_CAPABILITY structure with values
twCap.Cap = ICAP_FRAMES;
twCap.ConType = TWON_ONEVALUE;
nRet = MyClass->GetCapability(&twCap, LTWAIN_CAPABILITY_GETCURRENT);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability"), TEXT("ERROR"), MB_OK);
return;
}
nRet = MyClass->GetNumericContainerItemType(&twCap, &nItemType);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability item type"), TEXT("ERROR"), MB_OK);
}
else if (nItemType == TWTY_BOOL)
{
nRet = MyClass->GetNumericContainerFRAMEValue (&twCap, 0, &twFrame);
if (nRet != SUCCESS)
MessageBox (NULL, TEXT("Failed to get capability item value"), TEXT("ERROR"), MB_OK);
}
}


LTwain::GetNumericContainerINTValue

#include "ltwrappr.h"

virtual L_INT LTwain::GetNumericContainerINTValue(pCapability, nIndex, pnValue)

TW_CAPABILITY * pCapability; | /* pointer to a structure */
L_INT nIndex; | /* value's index */
L_INT *pnValue; | /* pointer to an integer value */

Gets the specified value from a container.

Parameter | Description
pCapability | Pointer to a TW_CAPABILITY structure that references the container value to get.
nIndex | Index of the value to get. Possible values are:
 | Value | Meaning
 | LTWAIN_VALUE_COUNT | [-1] Update ppValue with the number of items in the item list of the specified container. This option is only valid if the container is of type TW_ARRAY or TW_ENUMERATION. If the container is of any other type, this function will return an error code.
 | LTWAIN_VALUE_CURRENT | [-2] Update ppValue with the current value of the container. If the container is of type TW_RANGE, ppValue is updated with the CurrentValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ppValue is updated with the CurrentIndex member of the TW_ENUMERATION structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_DEFAULT | [-3] Update ppValue with the default value of the container. If the container is of type TW_RANGE, ppValue is updated with the DefaultValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ppValue is updated with the DefaultIndex member of the TW_ENUMERATION structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_MINIMUM | [-4] Update ppValue with the minimum value of the container. If the container is of type TW_RANGE, ppValue is updated with the MinValue member of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_MAXIMUM | [-5] Update ppValue with the maximum value of the container. If the container is of type TW_RANGE, ppValue is updated with the MaxValue member of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_STEPSIZE | [-6] Update ppValue with the step size of the container. If the container is of type TW_RANGE, ppValue is updated with the StepSize membr of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | >= 0 | Update ppValue with the value at the specified index. If the container is of type TW_ONEVALUE, nIndex must be zero and ppValue will be updated with the value of the TW_ONEVALUE structure. If the container is of type TW_ARRAY or TW_ENUMERATION, ppValue will be updated with the value at the specified index in the list of items. If the container is of type TW_ENUMERATION or TW_ARRAY, the value must not exceed the number of items in the container's item list or the function will return an error code.
pnValue | Pointer to an integer value to be updated with the specified container value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Use this function to get a value from a container's item list when the item list type is integer.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::GetNumericContainerItemType, LTwain::GetNumericContainerUINTValue, LTwain::GetNumericContainerBOOLValue, LTwain::GetNumericContainerFIX32Value, LTwain::GetNumericContainerFRAMEValue, LTwain::GetNumericContainerSTRINGValue, LTwain::GetNumericContainerUNICODEValue.
Topics: | How to Work with the Containers
 | TWAIN Functionality: Container Functions.

Example

// initialize session and call this function
void MyTestFunction(LTwain *MyClass)
{
L_INT nRet;
L_INT nItemType;
TW_CAPABILITY twCap;

// Fill the TW_CAPABILITY structure with values
twCap.Cap = ICAP_FRAMES;
twCap.ConType = TWON_ONEVALUE;
nRet = MyClass->GetCapability(&twCap, LTWAIN_CAPABILITY_GETCURRENT);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability"), TEXT("ERROR"), MB_OK);
return;
}
nRet = MyClass->GetNumericContainerItemType(&twCap, &nItemType);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability item type"), TEXT("ERROR"), MB_OK);
}
else if (nItemType == TWTY_BOOL)
{
nRet = MyClass->GetNumericContainerINTValue (&twCap, 0, NULL);
if (nRet != SUCCESS)
MessageBox (NULL, TEXT("Failed to get capability item value"), TEXT("ERROR"), MB_OK);
}
}


LTwain::GetNumericContainerItemType

#include "ltwrappr.h"

virtual L_INT LTwain::GetNumericContainerItemType(pCapability, pnItemType)

TW_CAPABILITY * pCapability; | /* pointer to a structure */
L_INT *pnItemType; | /* container type */

Gets the item type of the container of the specified capability.

Parameter | Description
pCapability | Pointer to a TW_CAPABILITY structure. The nItemType parameter will be updated with the item type of this structure's container.
pnItemType | Pointer to an integer to be updated with the container's item type.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::GetNumericContainerINTValue, LTwain::GetNumericContainerUINTValue, LTwain::GetNumericContainerBOOLValue, LTwain::GetNumericContainerFIX32Value, LTwain::GetNumericContainerFRAMEValue, LTwain::GetNumericContainerSTRINGValue, LTwain::GetNumericContainerUNICODEValue.
Topics: | How to Work with the Containers
 | TWAIN Functionality: Container Functions.

Example

For an example, refer to LTwain::GetNumericContainerUINTValue.


LTwain::GetNumericContainerSTRINGValue

#include "ltwrappr.h"

virtual L_INT LTwain::GetNumericContainerSTRINGValue(pCapability, nIndex, twString)

TW_CAPABILITY * pCapability; | /* pointer to a structure */
L_INT nIndex; | /* value's index */
TW_STR1024 twString; | /* reference to a TW_STR1024 value */

Gets the specified value from a container.

Parameter | Description
pCapability | Pointer to a TW_CAPABILITY structure that references the container value to get.
nIndex | Index of the value to get. Possible values are:
 | Value | Meaning
 | LTWAIN_VALUE_COUNT | [-1] Update ppValue with the number of items in the item list of the specified container. This option is only valid if the container is of type TW_ARRAY or TW_ENUMERATION. If the container is of any other type, this function will return an error code.
 | LTWAIN_VALUE_CURRENT | [-2] Update ppValue with the current value of the container. If the container is of type TW_RANGE, ppValue is updated with the CurrentValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ppValue is updated with the CurrentIndex member of the TW_ENUMERATION structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_DEFAULT | [-3] Update ppValue with the default value of the container. If the container is of type TW_RANGE, ppValue is updated with the DefaultValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ppValue is updated with the DefaultIndex member of the TW_ENUMERATION structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_MINIMUM | [-4] Update ppValue with the minimum value of the container. If the container is of type TW_RANGE, ppValue is updated with the MinValue member of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_MAXIMUM | [-5] Update ppValue with the maximum value of the container. If the container is of type TW_RANGE, ppValue is updated with the MaxValue member of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_STEPSIZE | [-6] Update ppValue with the step size of the container. If the container is of type TW_RANGE, ppValue is updated with the StepSize membr of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | >= 0 | Update ppValue with the value at the specified index. If the container is of type TW_ONEVALUE, nIndex must be zero and ppValue will be updated with the value of the TW_ONEVALUE structure. If the container is of type TW_ARRAY or TW_ENUMERATION, ppValue will be updated with the value at the specified index in the list of items. If the container is of type TW_ENUMERATION or TW_ARRAY, the value must not exceed the number of items in the container's item list or the function will return an error code.
twString | A TW_STR1024 value to be updated with the specified container value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Use this function to get a value from a container's item list when the item list type is TW_STR1024.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::GetNumericContainerItemType, LTwain::GetNumericContainerINTValue, LTwain::GetNumericContainerUINTValue, LTwain::GetNumericContainerBOOLValue, LTwain::GetNumericContainerFIX32Value, LTwain::GetNumericContainerFRAMEValue, LTwain::GetNumericContainerUNICODEValue.
Topics: | How to Work with the Containers
 | TWAIN Functionality: Container Functions.

Example

// initialize session and call this function
void MyTestFunction(LTwain *MyClass)
{
L_INT nRet;
L_INT nItemType;
TW_STR1024 twString;
TW_CAPABILITY twCap;

// Fill the TW_CAPABILITY structure with values
twCap.Cap = ICAP_HALFTONES;
twCap.ConType = TWON_ONEVALUE;
nRet = MyClass->GetCapability(&twCap, LTWAIN_CAPABILITY_GETCURRENT);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability"), TEXT("ERROR"), MB_OK);
return;
}

nRet = MyClass->GetNumericContainerItemType(&twCap, &nItemType);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability item type"), TEXT("ERROR"), MB_OK);
}
else if (nItemType == TWTY_BOOL)
{
nRet = MyClass->GetNumericContainerSTRINGValue (&twCap, 0, twString);
if (nRet != SUCCESS)
MessageBox (NULL, TEXT("Failed to get capability item value"), TEXT("ERROR"), MB_OK);
}
}


LTwain::GetNumericContainerUINTValue

#include "ltwrappr.h"

virtual L_INT LTwain::GetNumericContainerUINTValue(pCapability, nIndex, puValue)

TW_CAPABILITY * pCapability; | /* pointer to a structure */
L_INT nIndex; | /* value's index */
L_UINT *puValue; | /* pointer to an integer value */

Gets the specified value from a container.

Parameter | Description
pCapability | Pointer to a TW_CAPABILITY structure that references the container value to get.
nIndex | Index of the value to get. Possible values are:
 | Value | Meaning
 | LTWAIN_VALUE_COUNT | [-1] Update ppValue with the number of items in the item list of the specified container. This option is only valid if the container is of type TW_ARRAY or TW_ENUMERATION. If the container is of any other type, this function will return an error code.
 | LTWAIN_VALUE_CURRENT | [-2] Update ppValue with the current value of the container. If the container is of type TW_RANGE, ppValue is updated with the CurrentValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ppValue is updated with the CurrentIndex member of the TW_ENUMERATION structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_DEFAULT | [-3] Update ppValue with the default value of the container. If the container is of type TW_RANGE, ppValue is updated with the DefaultValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ppValue is updated with the DefaultIndex member of the TW_ENUMERATION structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_MINIMUM | [-4] Update ppValue with the minimum value of the container. If the container is of type TW_RANGE, ppValue is updated with the MinValue member of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_MAXIMUM | [-5] Update ppValue with the maximum value of the container. If the container is of type TW_RANGE, ppValue is updated with the MaxValue member of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_STEPSIZE | [-6] Update ppValue with the step size of the container. If the container is of type TW_RANGE, ppValue is updated with the StepSize membr of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | >= 0 | Update ppValue with the value at the specified index. If the container is of type TW_ONEVALUE, nIndex must be zero and ppValue will be updated with the value of the TW_ONEVALUE structure. If the container is of type TW_ARRAY or TW_ENUMERATION, ppValue will be updated with the value at the specified index in the list of items. If the container is of type TW_ENUMERATION or TW_ARRAY, the value must not exceed the number of items in the container's item list or the function will return an error code.
puValue | Pointer to an unsigned integer value to be updated with the specified container value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Use this function to get a value from a container's item list when the item list type is unsigned integer.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::GetNumericContainerItemType, LTwain::GetNumericContainerINTValue, LTwain::GetNumericContainerBOOLValue, LTwain::GetNumericContainerFIX32Value, LTwain::GetNumericContainerFRAMEValue, LTwain::GetNumericContainerSTRINGValue, LTwain::GetNumericContainerUNICODEValue.
Topics: | How to Work with the Containers
 | TWAIN Functionality: Container Functions.

Example

// initialize session and call this function
void MyTestFunction(LTwain *MyClass)
{
L_INT nRet;
L_INT nItemType;
L_UINT uValue;
TW_CAPABILITY twCap;

// Fill the TW_CAPABILITY structure with values
twCap.Cap = ICAP_UNITS;
twCap.ConType = TWON_ONEVALUE;
nRet = MyClass->GetCapability(&twCap, LTWAIN_CAPABILITY_GETCURRENT);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability"), TEXT("ERROR"), MB_OK);
return;
}

nRet = MyClass->GetNumericContainerItemType(&twCap, &nItemType);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability item type"), TEXT("ERROR"), MB_OK);
}
else if (nItemType == TWTY_BOOL)
{
nRet = MyClass->GetNumericContainerUINTValue (&twCap, 0, &uValue);
if (nRet != SUCCESS)
MessageBox (NULL, TEXT("Failed to get capability item value"), TEXT("ERROR"), MB_OK);
}
}


LTwain::GetNumericContainerUNICODEValue

#include "ltwrappr.h"

virtual L_INT LTwain::GetNumericContainerUNICODEValue(pCapability, nIndex, twUniCode)

TW_CAPABILITY * pCapability; | /* pointer to a structure */
L_INT nIndex; | /* value's index */
TW_UNI512 twUniCode; | /* reference to a TW_UNI512 value */

Gets the specified value from a container.

Parameter | Description
pCapability | Pointer to a TW_CAPABILITY structure that references the container value to get.
nIndex | Index of the value to get. Possible values are:
 | Value | Meaning
 | LTWAIN_VALUE_COUNT | [-1] Update ppValue with the number of items in the item list of the specified container. This option is only valid if the container is of type TW_ARRAY or TW_ENUMERATION. If the container is of any other type, this function will return an error code.
 | LTWAIN_VALUE_CURRENT | [-2] Update ppValue with the current value of the container. If the container is of type TW_RANGE, ppValue is updated with the CurrentValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ppValue is updated with the CurrentIndex member of the TW_ENUMERATION structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_DEFAULT | [-3] Update ppValue with the default value of the container. If the container is of type TW_RANGE, ppValue is updated with the DefaultValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ppValue is updated with the DefaultIndex member of the TW_ENUMERATION structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_MINIMUM | [-4] Update ppValue with the minimum value of the container. If the container is of type TW_RANGE, ppValue is updated with the MinValue member of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_MAXIMUM | [-5] Update ppValue with the maximum value of the container. If the container is of type TW_RANGE, ppValue is updated with the MaxValue member of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_STEPSIZE | [-6] Update ppValue with the step size of the container. If the container is of type TW_RANGE, ppValue is updated with the StepSize membr of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | >= 0 | Update ppValue with the value at the specified index. If the container is of type TW_ONEVALUE, nIndex must be zero and ppValue will be updated with the value of the TW_ONEVALUE structure. If the container is of type TW_ARRAY or TW_ENUMERATION, ppValue will be updated with the value at the specified index in the list of items. If the container is of type TW_ENUMERATION or TW_ARRAY, the value must not exceed the number of items in the container's item list or the function will return an error code.
twUniCode | A TW_UNI512 value to be updated with the specified container value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Use this function to get a value from a container's item list when the item list type is TW_UNI512.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::GetNumericContainerItemType, LTwain::GetNumericContainerINTValue, LTwain::GetNumericContainerUINTValue, LTwain::GetNumericContainerBOOLValue, LTwain::GetNumericContainerFIX32Value, LTwain::GetNumericContainerFRAMEValue, LTwain::GetNumericContainerSTRINGValue.
Topics: | How to Work with the Containers
 | TWAIN Functionality: Container Functions.

Example

// initialize session and call this function
void MyTestFunction(LTwain *MyClass)
{
L_INT nRet;
L_INT nItemType;
TW_UNI512 uValue;
TW_CAPABILITY twCap;

// Fill the TW_CAPABILITY structure with values
twCap.Cap = ICAP_UNITS;
twCap.ConType = TWON_ONEVALUE;
nRet = MyClass->GetCapability(&twCap, LTWAIN_CAPABILITY_GETCURRENT);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability"), TEXT("ERROR"), MB_OK);
return;
}

nRet = MyClass->GetNumericContainerItemType(&twCap, &nItemType);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability item type"), TEXT("ERROR"), MB_OK);
}
else if (nItemType == TWTY_BOOL)
{
nRet = MyClass->GetNumericContainerUNICODEValue(&twCap, 0, uValue);
if (nRet != SUCCESS)
MessageBox (NULL, TEXT("Failed to get capability item value"), TEXT("ERROR"), MB_OK);
}
}


LTwain::GetNumericContainerValue

#include "ltwrappr.h"

virtual L_INT LTwain::GetNumericContainerValue (pCapability, nIndex, ppValue)

TW_CAPABILITY * pCapability; | /* pointer to a structure */
L_INT nIndex; | /* value's index */
L_VOID ** ppValue; | /* variable to be allocated by the function */

Gets the specified value from a container.

Parameter | Description
pCapability | Pointer to a structure that contains the capability container value to get.
nIndex | Index of the value to get. Possible values are:
 | Value | Meaning
 | LTWAIN_VALUE_COUNT | [-1] Update ppValue with the number of items in the item list of the specified container. This option is only valid if the container is of type TW_ARRAY or TW_ENUMERATION. If the container is of any other type, this function will return an error code.
 | LTWAIN_VALUE_CURRENT | [-2] Update ppValue with the current value of the container. If the container is of type TW_RANGE, ppValue is updated with the CurrentValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ppValue is updated with the CurrentIndex member of the TW_ENUMERATION structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_DEFAULT | [-3] Update ppValue with the default value of the container. If the container is of type TW_RANGE, ppValue is updated with the DefaultValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ppvalue is updated with the DefaultIndex member of the TW_ENUMERATION structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_MINIMUM | [-4] Update ppValue with the minimum value of the container. If the container is of type TW_RANGE, ppValue is updated with the MinValue member of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_MAXIMUM | [-5] Update ppValue with the maximum value of the container. If the container is of type TW_RANGE, ppValue is updated with the MaxValue member of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | LTWAIN_VALUE_STEPSIZE | [-6] Update ppValue with the step size of the container. If the container is of type TW_RANGE, ppValue is updated with the StepSize membr of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
 | >= 0 | Update ppValue with the value at the specified index. If the container is of type TW_ONEVALUE, nIndex must be zero and ppValue will be updated with the value of the TW_ONEVALUE structure. If the container is of type TW_ARRAY or TW_ENUMERATION, ppValue will be updated with the value at the specified index in the list of items. If the container is of type TW_ENUMERATION or TW_ARRAY, the value must not exceed the number of items in the container's item list or the function will return an error code.
ppValue | Variable to be allocated by the function and updated with the specified value. The user must free this value using the Windows APIs GlobalUnlock and GlobalFree functions.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::CreateNumericContainerOneValue, LTwain::CreateNumericContainerEnum, LTwain::CreateNumericContainerArray, LTwain::CreateNumericContainerRange, LTwain::FreeContainer.
Topics: | How to Work with the Containers
 | TWAIN Functionality: Container Functions.

Example

// initialize session and call this function
L_INT MyTestFunction(LTwain *MyClass)
{
L_INT nRet;
L_UINT16 * pVal = NULL;
TW_CAPABILITY twCap;

twCap.Cap = ICAP_XFERMECH;
twCap.ConType = TWON_DONTCARE16;
nRet = MyClass->GetCapability(&twCap, LTWAIN_CAPABILITY_GETCURRENT);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability"), TEXT("ERROR"), MB_OK);
return FAILURE;
}

if (twCap.ConType == TWON_ONEVALUE)
nRet = MyClass->GetNumericContainerValue(&twCap, 0, (L_VOID **)&pVal);
else
nRet = MyClass->GetNumericContainerValue(&twCap, LTWAIN_VALUE_CURRENT, (L_VOID **)&pVal);

if (nRet != SUCCESS)
return nRet;

return SUCCESS;
}


LTwain::GetNumOfCapsInFile

#include "ltwrappr.h"

virtual L_UINT LTwain::GetNumOfCapsInFile (hFile)

HTWAINTEMPLATEFILE hFile;

/* handle to an existing template file */

Gets the number of stored capabilities from the specified file.

Parameter | Description
hFile | Handle to an existing template file.

Returns

Number of capabilities in the specified file, if the function was successful.

Comments

The template file must be opened for reading by calling LTwain::OpenTemplateFile function.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::OpenTemplateFile, LTwain::AddCapabilityToFile, LTwain::GetCapabilityFromFile, LTwain::TemplateDlg, LTwain::CloseTemplateFile, LTwain::InitSession.
Topics: | Handling Template Files
 | TWAIN Functionality: Capability Functions.

Example

For an example, refer to LTwain::GetCapabilityFromFile.


LTwain::GetProperties

#include "ltwrappr.h"

virtual L_INT LTwain::GetProperties (pltProperties, uStructSize, uFlags)

pLTWAINPROPERTIES pltProperties; | /* pointer to a structure */
L_UINT uStructSize; | /* size of the LTWAINPROPERTIES structure, in bytes */
L_UINT uFlags; | /* optional flags */

Gets the current or default values of the properties defined in the LTWAINPROPERTIES structure.

Parameter | Description
pltProperties | Pointer to a LTWAINPROPERTIES structure to be updated with the current or default properties. This must be a valid pointer for an LTWAINPROPERTIES structure.
uStructSize | Size of the LTWAINPROPERTIES structure, in bytes, for versioning. Use sizeof(LTWAINPROPERTIES).
uFlags | Flag that indicates the property values to get. Possible values are:
 | Value | Meaning
 | LTWAIN_PROPERTIES_GETCURRENT | [3] Get the current values.
 | LTWAIN_PROPERTIES_GETDEFAULT | [4] Get the default values.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function lets the user get information on the properties contained in the LTWAINPROPERTIES structure. It is a high-level alternative to getting capabilities using the LTwain::GetCapability or LTwain::EnumCapabilities functions. For more information on getting and setting TWAIN capabilities, refer to Getting and Setting Capabilities.

To set properties, use the LTwain::SetProperties function.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetPropertyCallBack, LTwain::SetProperties, LTwain::SetCapability, LTwain::GetCapability, LTwain::InitSession, LTwain::EndSession.
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Property Functions.

Example

class CMyTwain : public LTwain
{
public:
L_INT SetPropertyCallBack(L_UINT uCap, L_INT nStatus, L_VOID * pValue);
};

L_INT CMyTwain::SetPropertyCallBack(L_UINT uCap, L_INT nStatus, L_VOID * pValue)
{
// Do you error notification or any other code here.

return SUCCESS;

}

// Function to change the transfer mode to file
L_INT TwainSetFileXferData (CMyTwain *MyClass)
{
L_INT nRet;
LTWAINPROPERTIES twProps;

// Initialize to zero
memset (&twProps, 0, LTWAINPROPERTIESSIZE);
twProps.ImageRes.uStructSize = IMAGERESOLUTIONSIZE;
twProps.DataTransfer.uStructSize = DATATRANSFERSIZE;
twProps.ImageEff.uStructSize = IMAGEEFFECTSSIZE;

// Get the current properties of the selected twain source

   nRet = MyClass->GetProperties(&twProps, LTWAINPROPERTIESSIZE,LTWAIN_PROPERTIES_GETCURRENT);
if (nRet != SUCCESS)
return nRet;

// Change transfer mode to File
twProps.DataTransfer.nTransferMode = TWSX_FILE;
lstrcpy (twProps.DataTransfer.szFileName, TEXT("c:\\Twain.bmp"));
twProps.DataTransfer.nScanFileFormat = TWFF_BMP;

// Set the new properties
MyClass->EnableCallBack
 (TRUE);
nRet = MyClass->SetProperties(&twProps, LTWAIN_PROPERTIES_SET);
if (nRet != SUCCESS)
return nRet;

return SUCCESS;
}


LTwain::GetResolution

#include "ltwrappr.h"

L_INT LTwain::GetResolution (pXRes, pYRes);

pTW_FIX32 pXRes; | /* pointer to a variable */
pTW_FIX32 pYRes; | /* pointer to a variable */

Gets the current horizontal and vertical resolution used to transfer images from the current TWAIN source.

Parameter | Description
pXRes | Pointer to a variable to be updated with the current horizontal resolution value.
pYRes | Pointer to a variable to be updated with the current vertical resolution value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function gets the horizontal and vertical resolution capability values ICAP_XRESOLUTION and ICAP_YRESOLUTION. For more information on these capabilities, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

To set the resolution values, call the LTwain::SetResolution function.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

For an example, refer to LTwain::SetResolution.


LTwain::GetScanConfigs

#include "ltwrappr.h"

virtual L_INT LTwain::GetScanConfigs(nBitsPerPixel, uTransferMode, nBufferIteration, ppFastConfig, uStructSize, pnFastConfigCount)

L_INT nBitsPerPixel; | /* bits per pixel */
L_UINT uTransferMode; | /* transfer mode */
L_INT nBufferIteration; | /* buffer iteration */
pFASTCONFIG *ppFastConfig; | /* address of a pointer to the FASTCONFIG structure */
L_UINT uStructSize; | /* size of the FASTCONFIG structure, in bytes */
L_INT *pnFastConfigCount; | /* pointer to an integer */

Gets the default scan configurations for the given transfer mode, buffer iteration and bits per pixel. This function is available in the Document/Medical Toolkits.

Parameter | Description
nBitsPerPixel | The number of bits per pixel for which to get the default scan configurations.
uTransferMode | Transfer mode for which to get the default scan configurations.
 | Value | Meaning
 | LTWAIN_FILE_MODE | [0x001] Use File transfer mode
 | LTWAIN_BUFFER_MODE | [0x002] Use Memory transfer mode
 | LTWAIN_NATIVE_MODE | [0x004] Use Native transfer mode
nBufferIteration | Number used to determine the number of memory configurations that will be tested. This function uses this number to determine which default scan configurations to get.
ppFastConfig | Address of a pointer to a FASTCONFIG structure. This function will automatically allocate an array of FASTCONFIG structures using the total number of scan configurations. This array will be updated with the scan configurations retrieved based on the specified bits per pixel, transfer mode and number of buffers.
uStructSize | Size of the FASTCONFIG structure, in bytes, for versioning. Use sizeof(FASTCONFIG).
pnFastConfigCount | Pointer to an integer to be updated with number of scan configurations in ppFastConfig.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

If uTransferMode is LTWAIN_NATIVE_MODE, this function will use the value of nBitsPerPixel to determine which scan configurations to get.

If uTransferMode is LTWAIN_BUFFER_MODE, this function will use both nBitsPerPixel and nBufferIteration to determine which scan configurations to get.

If uTransferMode is LTWAIN_FILE_MODE, this function will use the value of nBitsPerPixel to determine which scan configurations to get.

This function allocates storage for the array of scan configurations in ppFastConfig. When this storage is no longer needed, you must free the storage by calling LTwain::FreeScanConfig.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::Acquire, LTwain::AcquireList, LTwain::InitSession, LTwain::EndSession, LTwain::OpenTemplateFile, LTwain::CloseTemplateFile, LTwain::TemplateDlg, LTwain::AddCapabilityToFile, LTwain::GetNumofCapsInFile, LTwain::GetCapabilityFromFile, LTwain::AcquireMulti, LTwain::FindFastConfig, LTwain::FreeScanConfig
Topics: | Fast TWAIN (Scan Configurations)
 | TWAIN Functionality: Fast TWAIN (Scan Configuration) Functions.

Example

For an example, refer to LTwain::FindFastConfig.


LTwain::GetSources

#include "ltwrappr.h"

virtual L_INT LTwain::GetSources (uFlags, uStructSize)

L_UINT uFlags; | /* optional flags */
L_UINT uStructSize; | /* size of the LTWAINSOURCEINFO structure, in bytes */

Gets the available information for the TWAIN sources installed on the system.

Parameter | Description
uFlags | Flags that indicate what sources to get. Possible values are:
 | Value | Meaning
 | LTWAIN_SOURCE_ENUMERATE_ALL | [0x0000] Enumerates all the available sources.
 | LTWAIN_SOURCE_ENUMERATE_DEFAULT | [0x0001] Gets only the default source (currently selected).
uStructSize | Size of the LTWAINSOURCEINFO structure, in bytes, for versioning. Use sizeof(LTWAINSOURCEINFO).

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SelectSource, LTwain::SourceInfoCallBack
Topics: | Managing the TWAIN Source
 | TWAIN Functionality: Property Functions.

Example

class CMyTwain : public LTwain
{
public:
L_INT SourceInfoCallBack(pLTWAINSOURCEINFO pSourceInfo);
};

L_INT CMyTwain::SourceInfoCallBack(pLTWAINSOURCEINFO pSourceInfo)
{
L_TCHAR szBuffer[MAX_PATH];

memset(szBuffer, 0, sizeof(szBuffer));
wsprintf(szBuffer, TEXT("Source Name = %s\nProduct Family = %s\nManufacturer = %s\n"),
pSourceInfo->pszTwnSourceName,
pSourceInfo->pszTwnProductFamily,
pSourceInfo->pszTwnManufacturer);

MessageBox(NULL, szBuffer, TEXT("Source Info."), MB_OK);
return TWAIN_SUCCESS;

}

// initialize session and call this function
L_VOID TwainGetAvailableSources (CMyTwain *MyClass)
{
L_INT nRet;
MyClass->EnableCallBack
 (TRUE);
nRet = MyClass->GetSources(LTWAIN_SOURCE_ENUMERATE_ALL , sizeof(LTWAINSOURCEINFO));
if (nRet != SUCCESS)
MessageBox (NULL, TEXT("Error during the enumeration procedure"), TEXT("ERROR"), MB_OK);
}


LTwain::GetSupportedTransferMode

#include "ltwrappr.h"

L_INT LTwain::GetSupportedTransferMode (pTransferModes);

L_UINT * pTransferModes;

/* pointer to a variable */

Gets all transfer modes supported by the current TWAIN source.

Parameter | Description
pTransferModes | Pointer to a variable to be updated with a value that represents the supported transfer modes. Values may be combined using a bitwise OR ( | ). Possible values are:
 | Value | Meaning
 | TWAIN_TRANSFER_FILE | [0x001] Specifies the file transfer mode.
 | TWAIN_TRANSFER_MEMORY | [0x002] Specifies the memory transfer mode.
 | TWAIN_TRANSFER_NATIVE | [0x004] Specifies the native transfer mode.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::SetResolution, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

For an example, refer to LTwain::SetTransferOptions.


LTwain::GetTransferOptions

#include "ltwrappr.h"

L_INT LTwain::GetTransferOptions (pTransferOpts, uStructSize)

pTRANSFEROPTIONS pTransferOpts; | /* pointer to a structure */
L_UINT uStructSize; | /* size of the TRANSFEROPTIONS structure */

Gets the current transfer options for the selected Twain source.

Parameter | Description
pTransferOpts | Pointer to the TRANSFEROPTIONS structure to be updated with the current transfer options.
uStructSize | Size in bytes, of the structure pointed to by pTransferOpts, for versioning. Use sizeof(TRANSFEROPTIONS).

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

To set transfer options for the selected Twain driver, call the LTwain::SetTransferOptions function.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

For an example, refer to LTwain::SetTransferOptions.


LTwain::InitSession

#include "ltwrappr.h"

virtual L_INT LTwain::InitSession (pAppData)

pAPPLICATIONDATA pAppData;

/* pointer to a structure */

Initializes the TWAIN session.

Parameter | Description
pAppData | Pointer to an APPLICATIONDATA structure. This structure will have the handle of the parent window in addition to other data about the application.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

LTwain::InitSession must be called before calling any other LTwain object functions.

When the handle to the TWAIN session is no longer needed, it should be freed by calling LTwain::EndSession. For every call to LTwain::InitSession there must be a call to LTwain::EndSession.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::EndSession, Class Members
Topics: | Initializing a TWAIN Session
 | TWAIN Functionality: Session Functions.

Example

For an example, refer to LTwain::IsAvailable.


LTwain::IsAvailable

#include "ltwrappr.h"

virtual L_BOOL LTwain::IsAvailable()

Determines whether a TWAIN source is installed.

Returns

TRUE | At least one TWAIN source is installed.
FALSE | No TWAIN source is installed.

Comments

You can use this function when deciding whether to enable or disable TWAIN menu items.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::Acquire, LTwain::AcquireList, LTwain::InitSession, LTwain::EndSession, LTwain::OpenTemplateFile, LTwain::CloseTemplateFile, LTwain::TemplateDlg, LTwain::AddCapabilityToFile, LTwain::GetNumofCapsInFile, LTwain::GetCapabilityFromFile.
Topics: | TWAIN Functionality: Property Functions

Example

void TestTWAIN2(HWND hWnd, HBITMAPLIST hBitmap)
{
L_BOOL bAvailable;
L_INT nRet;
LTwain MyClass;
APPLICATIONDATA AppData;

/* Check to see if TWAIN is installed */
bAvailable = MyClass.IsAvailable();
if (bAvailable)
{
AppData.hWnd = hWnd;
AppData.uStructSize = sizeof(APPLICATIONDATA);
lstrcpy (AppData.szManufacturerName, TEXT("LEAD Technologies, Inc."));
lstrcpy (AppData.szAppProductFamily, TEXT("LEAD Test Applications"));
lstrcpy (AppData.szVersionInfo, TEXT("Version 1.0"));
lstrcpy (AppData.szAppName, TEXT("TWAIN Test Application"));
nRet = MyClass.InitSession(&AppData);
if (nRet != SUCCESS)
return;

MyClass.AcquireList(hBitmap, NULL, LTWAIN_SHOW_USER_INTERFACE);
MyClass.EndSession();
}
}


LTwain::LockContainer

#include "ltwrappr.h"

virtual L_INT LTwain::LockContainer(pCapability, ppContainer)

TW_CAPABILITY * pCapability; | /* pointer to a structure */
void ** ppContainer; | /* pointer to a pointer to a structure */

Gets the container information for the specified capability.

Parameter | Description
pCapability | Pointer to a TW_CAPABILITY structure from which to get the container.
ppContainer | Pointer to be updated with a pointer to the container.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function is used to lock the container present in the TW_CAPABILITY structure.

Once the user has the pointer to the container, the container may be changed. When the user has finished changing the container he or she must call LTwain::UnlockContainer to unlock the container. Note that this can also be accomplished using the API GlobalLock and GlobalUnlock functions.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::UnlockContainer.
Topics: | How to Work with the Containers
 | TWAIN Functionality: Container Functions.

Example

void MyTestFunction(LTwain *MyClass)
{
TW_CAPABILITY twCap;
TW_ONEVALUE * ptwOneVal = NULL;
L_INT nRet;
twCap.Cap = ICAP_XFERMECH;
twCap.ConType = TWON_DONTCARE16;

nRet = MyClass->GetCapability(&twCap, LTWAIN_CAPABILITY_GETCURRENT);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability"), TEXT("ERROR"), MB_OK);
return;
}

if (twCap.ConType == TWON_ONEVALUE)
{
MyClass->LockContainer(&twCap, (void **)&ptwOneVal);
if (ptwOneVal)
{
// Do processing
MyClass->UnlockContainer(&twCap);
}
}
}


LTwain::OpenTemplateFile

#include "ltwrappr.h"

virtual L_INT LTwain::OpenTemplateFile (phFile, lpszTemplateFile, uAccess)

HTWAINTEMPLATEFILE * phFile; | /* handle to an existing template file */
L_TCHAR * lpszTemplateFile; | /* pointer to a character string */
L_UINT uAccess; | /* optional flag */

Opens the specified template file for loading or saving data.

Parameter | Description
phFile | Pointer to a HTWAINTEMPLATEFILE file handle.
lpszTemplateFile | Character string that contains the name of the template file to open. A LEADTOOLS template files extension is .ltt.
uAccess | Flag that indicates the access type for opening the file. Possible values are:
 | Value | Meaning
 | LTWAIN_TEMPLATE_OPEN_READ | [0] Open the template file for reading. This should be used to load data from an existing template file.
 | LTWAIN_TEMPLATE_OPEN_WRITE | [1] Open the template file for writing. This should be used to save data to a template file.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

A template file can be opened for either reading or writing, but not both.

For more information on template files, refer to Handling Template Files.

When a file is opened for writing, a new file is created.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::TemplateDlg, LTwain::AddCapabilityToFile, LTwain::GetCapabilityFromFile, LTwain::GetNumOfCapsInFile, LTwain::CloseTemplateFile, LTwain::InitSession, LTwain::EndSession
Topics: | Handling Template Files
 | TWAIN Functionality: Template File Functions.

Example

For an example, refer to LTwain::AddCapabilityToFile.


LTwain::QueryProperty

#include "ltwrappr.h"

virtual L_INT LTwain::QueryProperty (uCapability, ppltProperty, uStructSize)

L_UINT uCapability; | /* capability constant */
pLTWAINPROPERTYQUERY * ppltProperty; | /* pointer to a pointer to a structure */
L_UINT uStructSize; | /* size of the LTWAINPROPERTY structure, in bytes */

Gets the available property values.

Parameter | Description
uCapability | This is a capability constant defined by the TWAIN 1.9 specification. For example if the user wants the value(s) for the transfer count, the uCapability will be ICAP_XFERCOUNT.
ppltProperty | Pointer to a pointer to a LTWAINPROPERTYQUERY structure to be updated with the property values.
 | The structure will be internally allocated if the function is successful.
 | The structure should be freed by calling LTwain::FreePropQueryStructure function
uStructSize | Size of the LTWAINPROPERTYQUERY structure, in bytes, for versioning. Use sizeof(LTWAINPROPERTYQUERY).

Returns

SUCCESS | The function was successful.
<1 | An error occurred. Refer to Return Codes.

Comments

Getting these values can help in determining what values a certain TWAIN source supports for a certain capability or property.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::GetProperties, LTwain::SetCapability, LTwain::GetCapability, LTwain::InitSession, LTwain::EndSession.
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Property Functions.

Example

class CMyTwain : public LTwain

{

//Create class here

};

L_INT CheckCapability (L_INT16 uValue, CMyTwain *MyClass)
{
L_INT nRet, nIndex;
pLTWAINPROPERTYQUERY pltQuery = NULL;

// Query capability possible values
nRet = MyClass->QueryProperty (ICAP_XRESOLUTION, &pltQuery , sizeof(LTWAINPROPERTYQUERY));
if (nRet != SUCCESS)
return nRet;

// Check for the available values of the file transfer property
switch (pltQuery->uType)
{
case TWON_ONEVALUE:
if (pltQuery->pltwOneValue->ItemType == TWTY_FIX32)
{
pTW_FIX32 ptwFixVal = (pTW_FIX32)pltQuery->pltwOneValue->Item;
if (ptwFixVal->Whole == uValue)
{
MyClass->FreePropQueryStructure(&pltQuery);
return SUCCESS;
}
}
break;
case TWON_ENUMERATION:
if (pltQuery->pltwEnumeration->ItemType == TWTY_FIX32)
{
pTW_FIX32 ptwFixVal;
for (nIndex = 0; nIndex < (L_INT)pltQuery->pltwEnumeration->NumItems; nIndex ++)
{
ptwFixVal = (pTW_FIX32)(pltQuery->pltwEnumeration->ItemList[nIndex]);
if (ptwFixVal->Whole == uValue)
{
MyClass->FreePropQueryStructure (&pltQuery);
return SUCCESS;
}
}
}
break;
}

MyClass->FreePropQueryStructure (&pltQuery);
return FAILURE;
}


LTwain::SaveCapCallBack

#include "ltwrappr.h"

virtual L_INT LTwain::SaveCapCallBack (pCapability)

pTW_CAPABILITY pCapability;

/* pointer to a structure */

Called by LTwain::TemplateDlg for each capability supported by a particular TWAIN source, before saving it to a specific template file.

Parameter | Description
pCapability | Pointer to the TW_CAPABILITY structure that references the capability data to save to the specified template file. For more information about TW_CAPABILITY, refer to the TWAIN 1.9 specification from the site http://www.twain.org/.

Returns

SUCCESS | The function was successful.
SUCCESS_ABORT | The callback wants to abort the saving procedure.
SUCCESS_DELETE | Abort saving procedure and delete the file.
< 1 | An error occurred. Refer to Return Codes.

Comments

This callback function will be enabled only if you enabled the callback functions by calling LBase::EnableCallBack (TRUE).

The user can only modify the capability data before saving it to the specified template file.

The user should not free the pointer to the TW_CAPABILITY structure within this callback.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::TemplateDlg.
Topics: | TWAIN Functionality: Callback Functions.

Example

For an example, refer to LTwain::TemplateDlg.


LTwain::SaveErrorCallBack

#include "ltwrappr.h"

virtual L_INT LTwain::SaveErrorCallBack (pCapability, uError)

pTW_CAPABILITY pCapability; | /* pointer to a structure */
L_UINT uError; | /* error code */

Called by LTwain::TemplateDlg when an error occurs while saving capability data supported by a particular TWAIN source to a specific template file.

Parameter | Description
pCapability | Pointer to the TW_CAPABILITY structure that references the capability data that was being saved to a specific template file when the error occurred. For more information about TW_CAPABILITY, refer to the TWAIN 1.9 specification from the site http://www.twain.org/.
uError | Error code.

Returns

SUCCESS | The function was successful.
SUCCESS_RETRY | Retry saving the capability value.
SUCCESS_ABORT | Abort the saving procedure.
SUCCESS_DELETE | Abort saving procedure and delete the file.

Comments

This callback function will be enabled only if you enabled the callback functions by calling LBase::EnableCallBack (TRUE).

The user should not free the pointer to the TW_CAPABILITY structure within this callback.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::TemplateDlg.
Topics: | TWAIN Functionality: Callback Functions.

Example

For an example, refer to LTwain::TemplateDlg.


LTwain::SelectSource

#include "ltwrappr.h"

virtual L_INT LTwain::SelectSource (pltSource)

pLTWAINSOURCE pltSource;

/* pointer to a structure */

Displays the TWAIN dialog box to be used to select a TWAIN source for acquiring images.

Parameter | Description
pltSource | Pointer to a structure that contains the name of the TWAIN source to select.

Returns

SUCCESS | The function was successful.
1 < | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::GetSources, LTwain::InitSession, LTwain::EndSession.
Topics: | Managing the TWAIN Source
 | TWAIN Functionality: Property Functions.

Example

For an example, refer to LTwain::Acquire.


LTwain::SetAcquirePageOptions

#include "ltwrappr.h"

L_INT LTwain::SetAcquirePageOptions (nPaperSize, nPaperDirection);

L_INT nPaperSize; | /* paper size */
L_INT nPaperDirection; | /* page orientation */

Sets the page size and orientation to use when transferring data from the current TWAIN source.

Parameter | Description
nPaperSize | The page size to set. For more information on possible values, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).
nPaperDirection | The page orientation to set. For more information on possible values, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function internally sets the page size capability ICAP_SUPPORTEDSIZES, and the page orientation capability ICAP_ORIENTATION. For more information on these capabilities, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

To get the current values of these capabilities, call the LTwain::GetAcquirePageOptions function.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::GetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

For an example, refer to LTwain::GetImageEffects.


LTwain::SetCapability

#include "ltwrappr.h"

virtual L_INT LTwain::SetCapability (pCapability, uFlags)

pTW_CAPABILITY pCapability; | /* pointer to a structure */
L_UINT uFlags; | /* optional flags */

Sets the value of the specified capability.

Parameter | Description
pCapability | Pointer to the TW_CAPABILITY structure that references the capability value to set. This structure must be allocated and filled with data corresponding to the required capability before passing it to the function.
uFlags | Flags that indicate whether to set or reset the capability value. Possible values are:
 | Value | Meaning
 | LTWAIN_CAPABILITY_SET | [1] Set the capability to the value specified in pCapability.
 | LTWAIN_CAPABILITY_RESET | [2] Reset the value of the capability to the default value defined by the TWAIN source. In this case the pCapability can be NULL since it is not needed.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetProperties, LTwain::GetProperties, LTwain::GetCapability, LTwain::InitSession, LTwain::EndSession.
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions.

Example

For an example, refer to LTwain::Acquire.


LTwain::SetImageBitsPerPixel

#include "ltwrappr.h"

L_INT LTwain::SetImageBitsPerPixel (nBitsPerPixel);

L_INT nBitsPerPixel;

/* bits per pixel */

Sets the bits per pixel to use when transferring images from the current TWAIN source.

Parameter | Description
nBitsPerPixel | Number of bits per pixel to set. For more information on possible values, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function internally sets the bits per pixel capability ICAP_BITDEPTH. For more information on this capability, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

To obtain the current bits per pixel value, call the LTwain::GetImageBitsPerPixel function

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

For an example, refer to LTwain::SetImageUnit.


LTwain::SetImageEffects

#include "ltwrappr.h"

L_INT LTwain::SetImageEffects (ulFlags, pBrightness, pContrast, pHighlight);

L_UINT32 ulFlags; | /* optional flags */
pTW_FIX32 pBrightness; | /* pointer to a variable */
pTW_FIX32 pContrast; | /* pointer to a variable */
pTW_FIX32 pHighlight; | /* pointer to a variable */

Sets the brightness, highlight and contrast values to use when transferring images from the current TWAIN source.

Parameter | Description
ulFlags | Flags that indicate which value(s) to set. You can combine values when appropriate by using a bitwise OR ( | ). Possible values are:
 | Value | Meaning
 | TWAIN_NEGOTIATE_BRIGHTNESS | [0x0010] Sets the brightness of the image.
 | TWAIN_NEGOTIATE_CONTRAST | [0x0020] Sets the contrast of the image.
 | TWAIN_NEGOTIATE_HIGHLIGHT | [0x0040] Sets the highlight of the image.
pBrightness | Pointer to a variable that contains the brightness value to set. Possible values range from –1000 to 1000.
pContrast | Pointer to a variable that contains the contrast value to set. Possible values range from –1000 to 1000.
pHighlight | Pointer to a variable that contains the highlight value to set. Possible values range from 0 to 255.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function internally sets the brightness capability ICAP_BRIGHTNESS, the highlight capability ICAP_HIGHLIGHT, and the contrast capability ICAP_CONTRAST. For more information on these capabilities, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

To get the current brightness, highlight, and contrast capability values, call the LTwain::GetImageEffects function.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

void TestEffects(LTwain * plTwain)
{
L_INT nRet = SUCCESS;

TW_FIX32 Brightness;
nRet = plTwain->GetImageEffects (TWAIN_NEGOTIATE_BRIGHTNESS, &Brightness, NULL, NULL);
if (nRet == SUCCESS)
{
if (Brightness.Whole != 100)
{
Brightness.Whole = 100;
plTwain->SetImageEffects(TWAIN_NEGOTIATE_BRIGHTNESS, &Brightness, NULL, NULL);
}
}

L_INT nPaperType, nPaperDirection;
nRet = plTwain->GetAcquirePageOptions (&nPaperType, &nPaperDirection);
if (nRet == SUCCESS)
{
if (nPaperDirection != TWOR_LANDSCAPE)
plTwain->SetAcquirePageOptions (TWSS_A4, TWOR_LANDSCAPE);
}
}


LTwain::SetImageFrame

#include "ltwrappr.h"

L_INT LTwain::SetImageFrame (pFrame);

pTW_FRAME pFrame;

/* pointer to a structure */

Sets the image frame used when transferring images from the current TWAIN source.

Parameter | Description
pFrame | Pointer to a variable that contains the image frame value to set.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The image frame specifies the size and location of the image to acquire. To obtain the current image frame value, call the LTwain::GetImageFrame function.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::GetResolution, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

TW_FIX32 FloatToTWFix32 (float Floater)
{
TW_FIX32 Fix32;
TW_INT32 Int32 = (TW_INT32)(Floater * 65536.0 + 0.5);
Fix32.Whole = (TW_INT16) (Int32 >> 16);
Fix32.Frac = (TW_UINT16) (Int32 & 0x0000FFFFL);

return Fix32;
}

void TestImageFrameOptions(LTwain * plTwain)
{
L_INT nRet = SUCCESS;

TW_FRAME frame;
nRet = plTwain->GetImageFrame (&frame);
if (nRet == SUCCESS)
{
frame.Left = FloatToTWFix32(0);
frame.Top = FloatToTWFix32(0);
frame.Right = FloatToTWFix32(8.5);
frame.Bottom = FloatToTWFix32(11);

plTwain->SetImageFrame(&frame);
}
}


LTwain::SetImageUnit

#include "ltwrappr.h"

L_INT LTwain::SetImageUnit (nUnit)

L_INT nUnit;

/* image unit */

Sets the image unit value used to transfer images from the current TWAIN source.

Parameter | Description
nUnit | Specifies the unit value to set. For more information on possible values, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function internally sets the image unit capability ICAP_UNITS. For more information on this capability, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

To obtain the current image unit value, call the LTwain::GetImageUnit function

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

void TestImageOptions(LTwain * plTwain)
{
L_INT nRet = SUCCESS;

L_INT nUnit;
nRet = plTwain->GetImageUnit (&nUnit);
if (nRet == SUCCESS)
{
if (nUnit == TWUN_INCHES)
plTwain->SetImageUnit(TWUN_INCHES);
}

L_INT nBPP;
nRet = plTwain->GetImageBitsPerPixel (&nBPP);
if (nRet == SUCCESS)
{
if (nBPP == 24)
plTwain->SetImageBitsPerPixel (24);
}
}


LTwain::SetJPEGCompression

#include "ltwrappr.h"

L_INT LTwain::SetJPEGCompression (pTwJpegComp, uFlag);

pTW_JPEGCOMPRESSION pTwJpegComp; | /* pointer to a structure */
L_UINT uFlag; | /* flag */

Sets or restores JPEG compression options for the specified TWAIN session.

Parameter | Description
pTwJpegComp | Pointer to a TW_JPEGCOMPRESSION structure that contains the JPEG compression options to set.
uFlag | Flag that indicates whether to set new or restore default JPEG compression options. Possible values are:
 | Value | Meaning
 | LTWAIN_SET_JPEG_COMPRESSION | [0x0001] Set new JPEG compression options.
 | LTWAIN_RESET_JPEG_COMPRESSION | [0x0002] Restore default JPEG compression options.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Depending upon the flag used, this function will either set JPEG compression options for the specified TWAIN session, or restore the default JPEG compression options for the specified TWAIN session.

For more information about TW_JPEGCOMPRESSION, refer to the TWAIN 1.9 specification from the site "http://www.twain.org/".

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::GetJPEGCompression, LTwain::InitSession
Topics: | Using JPEG compression for a TWAIN source
 | TWAIN Functionality: JPEG Compression Functions

Example

For an example, refer to LTwain::GetJPEGCompression.


LTwain::SetMaxXferCount

#include "ltwrappr.h"

L_INT LTwain::SetMaxXferCount (nMaxXferCount)

L_INT nMaxXferCount;

/* transfer image count */

Sets the maximum number of images that can be transferred from the current TWAIN source.

Parameter | Description
nMaxXferCount | Specifies the maximum number of images to be transferred from the current TWAIN source.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function internally sets the maximum transfer count capability CAP_XFERCOUNT. For more information on these capabilities, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

To get the current value for the CAP_XFERCOUNT capability, call the LTwain::GetMaxXferCount function.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

For an example, refer to LTwain::EnableDuplex.


LTwain::SetProperties

#include "ltwrappr.h"

virtual L_INT LTwain::SetProperties (pltProperties, uFlags)

pLTWAINPROPERTIES pltProperties; | /* pointer to a structure */
L_UINT uFlags; | /* optional flags */

Sets predefined capabilities of the TWAIN source in the form of properties.

Parameter | Description
pltProperties | Pointer to a LTWAINPROPERTIES structure that contains the values to set.
uFlags | Flags that indicate whether to set or reset the property values. Possible values are:
 | Value | Meaning
 | LTWAIN_PROPERTIES_SET | [1] Set the properties to the values specified in the LTWAINPROPERTIES structure.
 | LTWAIN_PROPERTIES_RESET | [2] Set the properties to their default values neglecting the values specified in the LTWAINPROPERTIES structure. In this case the LTWAINPROPERTIES pointer can be NULL since it is not used.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The function can set the values of the properties to the values specified in the LTWAINPROPERTIES structure or it can reset the values defined in the structure to their default values defined by the TWAIN source.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetPropertyCallBack, LTwain::GetProperties, LTwain::SetCapability, LTwain::GetCapability, LTwain::InitSession, LTwain::EndSession.
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Property Functions.

Example

For an example, refer to LTwain::GetProperties.


LTwain::SetPropertyCallBack

#include "ltwrappr.h"

virtual L_INT LTwain::SetPropertyCallBack (uCap, nStatus, pValue)

L_UINT uCap; | /* capability being set */
L_INT nStatus; | /* status variable */
L_VOID * pValue; | /* pointer to the original value */

Called for each property set using LTwain::SetProperties.

Parameter | Description
uCap | The capability being set. For more information on capability values, refer to the Twain 1.9 Specification, available at www.twain.org.
nStatus | This variable holds the value of the error that occurred while the property was being set.
pValue | Pointer to the original value. The user can cast this depending on the type of the property, and modify it.

Returns

SUCCESS | The function was successful.
SUCCESS_RETRY | Retry with the new value in *pValue parameter.
SUCCESS_ABORT | Abort the negotiation.

Comments

This callback function will be enabled only if you enabled the callback functions by calling LBase::EnableCallBack (TRUE).

The user should not free the pValue parameter within this callback.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetProperties.
Topics: | TWAIN Functionality: Callback Functions

Example

For an example, refer to LTwain::GetProperties.


LTwain::SetResolution

#include "ltwrappr.h"

L_INT LTwain::SetResolution (pXRes, pYRes)

pTW_FIX32 pXRes; | /* pointer to a variable */
pTW_FIX32 pYRes; | /* pointer to a variable */

Sets the horizontal and vertical resolution used to transfer images from the current TWAIN source.

Parameter | Description
pXRes | The horizontal resolution value to set.
pYRes | The vertical resolution value to set.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function internally sets the horizontal and vertical resolution capabilities ICAP_XRESOLUTION and ICAP_YRESOLUTION. For more information on these capabilities, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

To obtain the current resolution value, call the LTwain::GetResolution function.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

void TestResoultion(LTwain * plTwain)
{
L_INT nRet = SUCCESS;

TW_FIX32 XRes, YRes;
nRet = plTwain->GetResolution (&XRes, &YRes);
if (nRet == SUCCESS)
{
if (XRes.Whole != 300)
XRes.Whole = YRes.Whole = 300;

plTwain->SetResolution(&XRes, &YRes);
}
}


LTwain::SetRGBResponse

#include "ltwrappr.h"

L_INT LTwain::SetRGBResponse (pRgbResponse, nBitsPerPixel, uFlag)

pTW_RGBRESPONSE pRgbResponse; | /* pointer to the RGB response */
L_INT nBitsPerPixel; | /* bits per pixel */
L_UINT uFlag; | /* optional flags */

Sets the RGB elements used when transferring data from the current TWAIN source.

Parameter | Description
pRgbResponse | Pointer to a TW_RGBRESPONSE structure that references the RGB elements to be set for the TWAIN source. For more information about TW_RGBRESPONSE, www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).
nBitsPerPixel | Bits per pixel to be set. This is used to determine the number of RGB elements in the TW_RGBRESPONSE structure.
uFlag | Flags that indicate whether to set or reset the RGB elements for the TWAIN source. Possible values are:
 | Value | Meaning
 | TWAIN_RGB_RESPONSE_SET | [0x0001] Set the RGB elements for the current TWAIN source using the information provided.
 | TWAIN_RGB_RESPONSE_RESET | [0x0002] Reset the RGB elements for the current TWAIN source to the default values. Please note that defaults vary from TWAIN source to TWAIN source.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

void TestRGBResponse(LTwain * plTwain)
{
pTW_RGBRESPONSE pRgbResponse = NULL;
pRgbResponse = (pTW_RGBRESPONSE)GlobalAllocPtr(GHND, sizeof(TW_RGBRESPONSE) + sizeof(TW_ELEMENT8) * 2);
if (pRgbResponse)
{
pRgbResponse->Response[0].Index = 0;
pRgbResponse->Response[0].Channel1 = 0;
pRgbResponse->Response[0].Channel2 = 0;
pRgbResponse->Response[0].Channel3 = 0;

pRgbResponse->Response[1].Index = 1;
pRgbResponse->Response[1].Channel1 = 255;
pRgbResponse->Response[1].Channel2 = 255;
pRgbResponse->Response[1].Channel3 = 255;

plTwain->SetRGBResponse(pRgbResponse, 1, TWAIN_RGB_RESPONSE_SET);
}
}


LTwain::SetTransferOptions

#include "ltwrappr.h"

L_INT LTwain::SetTransferOptions(pTransferOpts);

pTRANSFEROPTIONS pTransferOpts;

/* pointer to a structure */

Sets the options used for transferring data from the current TWAIN source.

Parameter | Description
pTransferOpts | Pointer to the TRANSFEROPTIONS structure that contains the transfer options to set.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

To obtain the current transfer options, call the LTwain::GetTransferOptions function.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::ShowProgress, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

void TestTransferOptions(LTwain * plTwain)
{
L_INT nRet = SUCCESS;

L_UINT TransferModes = 0;
nRet = plTwain->GetSupportedTransferMode (&TransferModes);
if (nRet == SUCCESS)
{
if ((TransferModes & TWAIN_TRANSFER_FILE) == TWAIN_TRANSFER_FILE)
MessageBox(NULL, TEXT("File transfer is supported"), TEXT("Notice!"), MB_OK);
}

TRANSFEROPTIONS TransOpts;
memset(&TransOpts, 0, sizeof(TRANSFEROPTIONS));
plTwain->GetTransferOptions (&TransOpts, sizeof(TRANSFEROPTIONS));
if (nRet == SUCCESS)
{
if (TransOpts.TransferMode != TWAIN_TRANSFER_FILE)
{
TransOpts.TransferMode = TWAIN_TRANSFER_FILE;
strcpy(TransOpts.szFileName, TEXT("c:\\test.bmp"));
TransOpts.uFileFormat = TWFF_BMP;
}

plTwain->SetTransferOptions(&TransOpts);
}
}


LTwain::ShowProgress

#include "ltwrappr.h"

L_INT LTwain::ShowProgress (bShow)

L_BOOL bShow;

/* flag */

Enables or disables the display of a progress indicator during the acquisition of images from the current TWAIN source.

Parameter | Description
bShow | Flag that indicates whether to display a progress indicator during image acquisition from the current TWAIN source. Possible values are:
 | Value | Meaning
 | TRUE | Displays progress indicator during image acquisition.
 | FALSE | Hides the progress indicator during image acquisition.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SetTransferOptions, LTwain::GetTransferOptions, LTwain::GetSupportedTransferMode, LTwain::SetResolution, LTwain::GetResolution, LTwain::SetImageFrame, LTwain::GetImageFrame, LTwain::SetImageUnit, LTwain::GetImageUnit, LTwain::SetImageBitsPerPixel, LTwain::GetImageBitsPerPixel, LTwain::SetImageEffects, LTwain::GetImageEffects, LTwain::SetAcquirePageOptions, LTwain::GetAcquirePageOptions, LTwain::SetRGBResponse, LTwain::EnableDuplex, LTwain::GetDuplexOptions, LTwain::SetMaxXferCount, LTwain::GetMaxXferCount
Topics: | Getting and Setting Capabilities
 | TWAIN Functionality: Capability Functions

Example

void TestProgress(LTwain * plTwain)
{
plTwain->ShowProgress(TRUE);
}


LTwain::SourceInfoCallBack

#include "ltwrappr.h"

virtual L_INT LTwain::SourceInfoCallBack (pSourceInfo)

pLTWAINSOURCEINFO * pSourceInfo;

/* pointer to the LTWAINSOURCEINFO structure */

Called by LTwain::GetSources for each available TWAIN source installed on the system.

Parameter | Description
pSourceInfo | Pointer to the LTWAINSOURCEINFO structure that contains the name of the TWAIN source retrieved.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This callback function will be enabled only if you enabled the callback functions by calling LBase::EnableCallBack (TRUE).

This callback function gets the available information about the installed TWAIN sources on the system like the names of the TWAIN source, the scanner product family, and the manufacturer.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::GetSources.
Topics: | TWAIN Functionality: Callback Functions

Example

For an example, refer to LTwain::GetSources.


LTwain::TemplateDlg

#include "ltwrappr.h"

virtual L_INT LTwain::TemplateDlg (lpszTemplateFile)

L_TCHAR * lpszTemplateFile;

/* pointer to a character string */

Displays the TWAIN source manufacturer's template dialog, without actually acquiring an image.

Parameter | Description
lpsztemplateFile | A character string that contains the name of the template file used in the saving the capability values.

Returns

SUCCESS | The function was successful.
<1 | An error occurred. Refer to Return Codes.

Comments

This function saves the current values of all the supported capabilities to the specified file.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::SaveCapCallBack, LTwain::SaveErrorCallBack, LTwain::OpenTemplateFile, LTwain::AddCapabilityToFile, LTwain::GetCapabilityFromFile, LTwain::GetNumOfCapsInFile, LTwain::CloseTemplateFile, LTwain::InitSession, LTwain::EndSession.
Topics: | Handling Template Files
 | TWAIN Functionality: Template File Functions.

Example

class CMyTwain : public LTwain
{
public:
L_INT SaveCapCallBack(pTW_CAPABILITY pCapability);
L_INT SaveErrorCallBack(pTW_CAPABILITY pCapability, L_UINT uError);
};

L_INT CMyTwain::SaveCapCallBack(pTW_CAPABILITY pCapability)
{
// Do pre operations on data to save
return SUCCESS;
}

L_INT CMyTwain::SaveErrorCallBack(pTW_CAPABILITY pCapability, L_UINT uError)
{
// Do the error handling
return SUCCESS;
}

void TestTemplateDlg(L_TCHAR L_FAR * pszFileName, CMyTwain *MyClass)
{
MyClass->EnableCallBack
 (TRUE);
L_INT nRet = MyClass->TemplateDlg (pszFileName);
if (nRet != SUCCESS)
{
// Error check procedure
}
}


LTwain::UnlockContainer

#include "ltwrappr.h"

virtual L_INT LTwain::UnlockContainer (pCapability)

TW_CAPABILITY * pCapability;

/* pointer to a structure */

Sets the container information of the specified capability.

Parameter | Description
pCapability | Pointer to a TW_CAPABILITY structure that contains the information to set.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function is used to unlock the container present in the TW_CAPABILITY stucture.

To access the container so that it may be modified, call LTwain::LockContainer. This function provides the user with a pointer to the container. At this point the container may be changed. When the user has finished changing the container he or she must call LTwain::UnlockContainer to unlock the container. Note that this can also be accomplished using the API GlobalLock and GlobalUnlock functions.

Required DLLs and Libraries

LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | LTwain::LockContainer.
Topics: | How to Work with the Containers
 | TWAIN Functionality: Container Functions.

Example

For an example, refer to LTwain::LockContainer.


Raster Pro/Document/Medical Features

Raster Pro:

LEADTOOLS Raster Imaging Pro provides some imaging capabilities that are not available in the LEADTOOLS Raster Imaging product. In order to access these features, you must unlock them by calling LSettings::UnlockSupport (L_SUPPORT_LTPRO, L_KEY_LTPRO). L_KEY_LTPRO can be found in ltkey.h.

If you are a licensed user of LEADTOOLS Raster Imaging, and would like to access Raster Imaging Pro features, you must contact Tech Support for information on obtaining a license and the unlock key for calling LSettings::UnlockSupport.

Document/Medical:

LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite are the most comprehensive imaging toolkits on the market. No other toolkit provides as many imaging features for color, gray-scale and black & white images in one development package, and for one price. These toolkits comprise LEAD's best code and are designed for the programmer who is looking for the fastest performance, and/or the most extensive color, document, and medical imaging capabilities available.

These toolkits contain powerful annotation capabilities and optimized document image processing filters, and high performance compression, decompression and viewing of JPEG, LEAD CMP, MRC and CCITT G3/G4. The annotation capabilities enable the programmer to add text, highlights, sticky notes, audio, ellipses, buttons, lines, arrows, rectangles, polygons, redaction (blackout), hotspots, freehand scribble, pointers, bitmap and text stamps, to black & white and color images. Programmers working with document imaging will also find special processing filters such as despeckle, deskew, favor black, and scale to gray to enhance their black and white 1 bit images. Additionally, you can achieve faster rotation in 90-degree increments by applying a rotated view perspective to the bitmap. These LEADTOOLS toolkits offer the fastest software-only JPEG decoder available.

LEADTOOLS Document Imaging

The LEADTOOLS Document Imaging toolkit contains all the features available in the LEADTOOLS Raster Imaging Pro. In addition, it contains the following capabilities:

Special functions for Document (bitonal) images. The LEADTOOLS functions for bitonal images are especially useful for working with images from black-and-white scanners or FAX machines. These functions let you do things such as automatically straighten (deskew) an image, remove spots (despeckle), or clarify a scaled display (using scale-to-gray and favor-black features).

Annotation. LEADTOOLS supports annotation of images by letting you overlay images with text, lines, shapes, arrows, buttons, highlights, hot spots, sticky notes, stamps, buttons, and sounds.

Fast rotation. LEADTOOLS achieves fast rotation in 90-degree increments by applying a rotated view perspective to the bitmap.

ISIS support. LEADTOOLS supports ISIS interfaces for driving scanning devices.

Faster compression and decompression. The Document/Medical editions work faster when loading and saving LEAD CMP, JPEG, and CCITT Group 3 and Group 4 images. The LEADTOOLS functions for loading and saving are the same in all products. The only difference is in performance.

1-bit Image Clean-up. The Document toolkits include support for removing dots, blobs, holes, inverted text, lines, borders, bumps and nicks from 1-bit images.

Region Clean-up. [Document/Medical] Remove all the holes from a region.

Embedded Messages. The Document toolkits include support for embedding messages in lossless image formats like bmp, tiff, lossless jpeg, etc. The message is embedded without any visible changes to the image, and does not appreciably increase the size of the image. The message is password-protected.

Image Conversion. The Document toolkits include support for transforming a bitmap into a binary image using specified thresholds or a threshold calculated automatically based on statistical features of the bitmap.

12 and 16 bit grayscale images. [Document/Medical] Load, process, display, window level and save 12 and 16 bit grayscale images (including support for 16-bit grayscale TIFF).

48 and 64 bit color images. [Document/Medical] Load, process, display, and save 48 and 64 bit color images.

MRC Support. [Document/Medical] LEADTOOLS supports the Mixed Raster Content format for color documents containing mixed image and text components. For more information, refer to the

Halftoning. [Document/Medical] Convert 1-, 4-, 8-, 16-, 24-, or 32-bit bitmaps to a halftoned bitmap, with a specified pattern rotation. A halftoned bitmap is a 1-bit bitmap that has been dithered for black and white printing or display.

LEADTOOLS Document Imaging Suite

The LEADTOOLS Document Imaging Suite toolkit contains all the capabilities of LEADTOOLS Document Imaging, and includes the features listed below. Please note that the OCR features are included in this toolkit, however they can also be purchased as a plug-in for the LEADTOOLS Document Imaging toolkit. Also, JBIG support is provided in this toolkit, however a JBIG Module may be added on to LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging or LEADTOOLS Medical Imaging Suite.

OCR features. [Document/Medical] LEAD offers OCR features that use Scansoft Textbridge technology. Support for these features is included in the LEADTOOLS Document Imaging Suite, and can be added, via plug-in to the LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite toolkits. The OCR features allow you to perform optical character recognition and turn images into documents. Features include preset confidence and accuracy levels for controlling how sensitive the engine is to unrecognized text, artificial intelligence for improving recognition on documents of the same type, and built-in and user-defined lexicons for limiting the type of text to recognize within a particular zone. LEADTOOLS provides the ability to verify or correct text during, and (using LEAD's unique OCR editor) after recognition. LEAD's OCR editor ties the text being edited directly to the image, providing a visual reference to the original bitmap data. The OCR engine can perform Automatic area segmentation creating multi-layered zones, recognizing areas such as tables, rules, images and text. Or, you can manually designate up to 250 such zones. The OCR features support different fonts, sizes (5 to 72 point) and styles. Fax, dot matrix and halftones can be preprocessed to improve recognition results. The OCR Engine supports major European and Scandinavian languages (Danish, Dutch, Finnish, French, German, Italian, Norwegian, Portuguese, Russian, Spanish, and Swedish) as well as English. Support for dialects such as US. English, French Canadian, Latin American Spanish, Swiss German, and Brazilian Portuguese is also provided.

Recognized text can be exported to more than 40 different formats, including MS Word, MS Excel, Dbase andWordPerfect. The LEADTOOLS OCR features contain superior OCR processing speeds, for use in form recognition and processing applications.

LEAD's JBIG filter. [Document/Medical] LEAD includes support for this filter in the LEADTOOLS Document Imaging Suite toolkit. Support for this filter can be added to LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging or LEADTOOLS Medical Imaging Suite by purchasing the JBIG Module. JBIG defines a method for lossless compression encoding of a bi-level image (two-color image). This method can also be used for coding grayscale and color images. LEADTOOLS completely supports all three types of images, giving you the ability to make full use of this powerful compression technology. LEADTOOLS also supports the progressive capability of JBIG, allowing you to store and send multiple representations of images at different resolutions without any extra storage overhead.

LEADTOOLS Medical Imaging

LEADTOOLS Medical Imaging contains all the capabilities of LEADTOOLS Document Imaging. It also includes general medical imaging technologies (1-16,24,32 bit color, 1-16 bit grayscale and window leveling of 12 and 16-bit grayscale images) and support for the DICOM file format.

DICOM file support. [Medical] LEADTOOLS Medical Imaging provides COMPLETE support for the DICOM 3.0 specification, including all standard IOD classes and modalities (CR, CT, MR, NM, US, RF, SC, VL, etc.) and complete DICOM Basic Directory support.

Window leveling. [Document/Medical] Detect and set LowBit and HighBit for image data, display images with automatic LUT intensity expansion, or set LUT entries and ranges with specific values and gradients. Display images through the LUT without changing the data, or process the image data using the LUT. Linearize the number of pixels locally in a bitmap, based on the specified color space in order to bring out the detail in dark areas of an image, and smooth the edges between blocks.

Medical Imaging Processing. [Medical] LEADTOOLS Medical Imaging provides image processing functionality designed specifically to allow you to examine and improve the quality of medical images.

LEADTOOLS Medical Imaging Suite

LEADTOOLS Medical Imaging Suite contains all the capabilities of LEADTOOLS Medical Imaging. In addition, it supports the following:

DICOM Communication support. [Medical Suite] LEADTOOLS provides COMPLETE support for DICOM Communications, including all Service Classes (Verification, Storage, Query/Retrieve, Patient Management, etc), and contains high-level communications functions simplifying the creation of DICOM client/server applications.

(Document/Medical) is used in the documentation to designate the features that are available in LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite. Those features that are available only in the Medical toolkits are indicated in the documentation by (Medical). Features available only in the LEADTOOLS Medical Imaging Suite toolkit are indicated in the documentation by (Medical Suite).

(Internet only) is used in the documentation to designate the features that are available only in the LEADTOOLS Internet toolkit.

For more information, refer to Document/Medical Edition Support and Licensing Requirements .


LEADTOOLS Reference Manuals

LEADTOOLS provides reference manuals that contain the same information as the online help. You can print them from PDF files. Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.

To print the PDF files, you must use the Adobe Acrobat Reader 3.0 or higher. You can download a copy of the Acrobat Reader from the Adobe web site (http://www.adobe.com). Note that different versions of the Acrobat Reader are available for different operating systems, but they all can read the same PDF files.


Topic Selection

LEAD Technologies, Inc.
Suite 400,
1201 Greenwood Cliff,
Charlotte, NC 28204

Sales@Leadtools.com
www.leadtools.com

(704) 332-5532
FAX: (704) 372-8161
Tech Support: (704) 372-9681

LEADTOOLS is ideal for developers involved in still frame, multimedia, document, medical, and vector imaging projects, including Internet/Intranet applications. Independent of the specific application requirement – scanning, file format support/conversion, compression, image processing, annotation, database support, multimedia, etc. – LEADTOOLS provides the most comprehensive, robust, flexible, and powerful imaging solution available.

Click this button to start the Licensing help file to review the License Agreements governing your use of the software.

Click this button to start the Products help file to review the full line of LEADTOOLS Products.

Click this button to start the Imaging help file to review the full line of LEADTOOLS Image Categories.