Introduction

The LEADTOOLS TWAIN COM features are included in LEADTOOLS Raster Imaging Pro, LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging, and LEADTOOLS Medical Imaging Suite toolkits. This functionality is provided in the following objects:

LEAD RasterTwain Object provides an object for incorporating TWAIN functionality into your applications.

This object provides all the functionality needed to create robust applications with the ability:

to manage the TWAIN sources.

to acquire pages from a specified source.

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

In the documentation, the properties, methods and events in the LEAD RasterTwain Object are designated by (ILEADRasterTwain).

LEADTOOLS TWAIN COM supports UNICODE. For more information on using the samples in this help file with UNICODE, please refer to A Special Note About UNICODE Support.

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

You can use the LEADTOOLS TWAIN features in any programming environment that supports COM Objects, including the following:

Visual Basic Syntax
Visual C++ 5.0 Syntax

Delphi 4.0 and later
C++ Builder

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

Note:

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

The executable files for these examples were compiled with Document/Medical capabilities. The examples were also compiled with a TWAIN features license. To get Document/Medical capabilities, you must buy a LEADTOOLS Document/Medical toolkit. To get TWAIN features, you must buy one of the toolkits which includes the TWAIN features. Otherwise, if you recompile the examples, the resulting executable files will not have the Document/Medical, or TWAIN features.

Visual C++ 5.0

Twain Demo

EXAMPLES\COM\MSVC5\TWAIN contains a sample application that demonstrates most of the TWAIN features in the Visual C++ 5.0 environment. You can open the project in Visual C++; then compile and run it.

Visual Basic

VBTWN32 Demo

EXAMPLES\COM\VB\VBTWN32 contains a sample application that demonstrates most of the TWAIN features in the Visual Basic 5.0 environment. You can open the project in Visual Basic; then compile and run it.


Version History

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

Changes from Version 14 to Version 14.5

Changes from Version 13 to Version 14

Version 13


Changes from Version 14 to Version 14.5

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

LEADTOOLS TWAIN COM now supports JPEG compression.

LEADTOOLS TWAIN COM has added high-level functionality lets the user get and set specific capabilities, either singularly, or in groups.

LEADTOOLS provides the ability to obtain information from the TWAIN file system, and change settings within the TWAIN file system.

The rest of this topic lists the new properties, methods, and events in version 14.5:

JPEG Compression

GetJPEGCompression method

SetJPEGCompression method

JPEGCompressionData property

ColorSpace property

SubSampling property

NumComponents property

RestartFrequency property

QuantMap property

QuantTable property

HuffmanMap property

HuffmanDC property

HuffmanAC property

Flags property

Length property

Data property

High-Level

DuplexMode property

EnableDuplex property

GetTransferOptions method

ImageBitsPerPixel property

ImageBrightness property

ImageContrast property

ImageFrame property

ImageHighlight property

ImageUnit property

IsFileTransferAvailable property

IsMemoryTransferAvailable property

IsNativeTransferAvailable property

MaxXferCount property

PaperDirection property

PaperSize property

QueryFileSystem method

RGBElements property

RGBElementsCount property

SetRGBResponse method

SetTransferOptions method

ShowProgress method

TransferCompressionType property

TransferFileFormat property

TransferFileName property

TransferMode property

XResolution property

YResolution property

Twain File System

FileSystemInfo property

InputName property

OutputName property

Recursive property

FileType property

FileSize property

CreateTimeDate property

ModifiedTimeDate property

FreeMediaSpace property

NewImageSize property

NumberOfFiles property

NumberOfAudioSnippets property

DeviceGroupMask property

Channel1 property

Channel2 property

Channel3 property

Index property


Changes from Version 13 to Version 14

Version 14 of the LEADTOOLS Twain COM Object has been updated to work better with scripting languages. Methods that used to take pointer parameters now work with the new ILEADRasterVariant object.

LEADTOOLS Twain COM now supports UNICODE. For more information on using the samples in this help file with UNICODE, please refer to A Special Note About UNICODE Support.

LEADTOOLS Twain COM now supports high-level options for getting and setting capabilities.

The rest of this topic lists the new properties, methods, and events in version 14.

BitsPerPixel Property (ILTImageResolution)

BottomMargin property (ILEADRasterTwain)

Brightness property

BufferMemoryCompression property

CapabilityLong property (ICapability2 Interface)

ColorScheme property

Contrast property

DataTransfer property

DuplexScanning property

EnableAppendToFile property

EnableAutoFeed property

EnableDumpMemoryBuffersToFile property

EnableSaveMultipageFile property

EnableShowUserInterfaceOnly property

FillOrder property

GetProperties method

HalfTone property

HighLight property

HorizontalResolution property

ImageEffects property

ImageResolution property

LeftMargin property (ILEADRasterTwain)

MaxPagesNumber property

MemoryBufferSize property

PixelFlavor property

RightMargin property (ILEADRasterTwain)

RotationAngle property

ScanFileFormat property

SetProperties method

Shadow property

TopMargin property (ILEADRasterTwain)

TransferMode Property (ILTDataTransfer)

Unit property

VerticalResolution property

XScaling property

YScaling property


Version 13

Version 13 is the first version of LEADTOOLS Twain COM Object.

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

Acquire method

AcquireMultiEvent event

AcquireMulti method

AcquirePageEvent event

AcquireSourceName property

AppName property

ArrayItemType property

ArrayItemType property (ICapabilityArray2 Interface)

ArrayCapValue property

ArrayCapValue property (ICapabilityArray2 Interface)

ArrayNumOfItems property

ArrayNumOfItems property (ICapabilityArray2 Interface)

BestFastConfig Property

BitsPerPixel Property (ILTFastConfig)

BottomMargin property (ItwFrame Interface)

BufferSize Property

Capability property (ICapability)

Capability property (ICapability2 Interface)

Capability property (ILEADRasterTwain)

CapArray property (ILEADTwainCapability)

CapEnum property (ILEADTwainCapability)

CapInfo property (ILEADTwainCapability)

CapOneValue property (ILEADTwainCapability)

CapRange property (ILEADTwainCapability)

CapsCount property

CondCode property

ConType property

ConType property (ICapability2 Interface)

EnableAcquireMultiEvent Property

EnableFastConfigEvent Property

EnableLoadTemplateEvent property

EnableMethodErrors property

EnableSaveTemplateEvent property

EndSession method

EnumCapValue property

EnumCapValue property (ICapabilityEnumeration2 Interface)

EnumCurrentIndex property

EnumCurrentIndex property (ICapabilityEnumeration2 Interface)

EnumDefaultIndex property

EnumDefaultIndex property (ICapabilityEnumeration2 Interface)

EnumItemType property

EnumItemType property (ICapabilityEnumeration2 Interface)

EnumNumOfItems property

EnumNumOfItems property (ICapabilityEnumeration2 Interface)

FamilyName property

FastBitsPerPixel Property

FastBufferSize Property

FastConfigEvent event

FastConfigsResult Property

FastConfigsResultCount Property

FastFormat Property

FastTransferMode Property

FastUsePreferredBufferSize Property

FileFormat Property

FileTransferName property

FindFastConfig method

GetCapability method

GetCapability2 method

GetExtImageInfo method

GetScanConfigs method

InfoID property

InitSession method

IsAvailable method

Item property

ItemType property

LeftMargin property (ItwFrame Interface)

LoadTemplate method

LoadTemplateEvent event

LoadTemplateEvent2 event

ManName property

ManufacturerName property

MemBufSize property

NumOfInfos property

NumOfItems property

OneValCapValue property

OneValCapValue property (ICapabilityOneValue2 Interface)

OneValItemType property

OneValItemType property (ICapabilityOneValue2 Interface)

ProdFamily property

PtwInfo property

QueryCapability method

RangeCurrentValue property

RangeCurrentValue property (ICapabilityRange2 Interface)

RangeDefaultValue property

RangeDefaultValue property (ICapabilityRange2 Interface)

RangeItemType property

RangeItemType property (ICapabilityRange2 Interface)

RangeMaximumValue property

RangeMaximumValue property (ICapabilityRange2 Interface)

RangeMinimumValue property

RangeMinimumValue property (ICapabilityRange2 Interface)

RangeStepSize property

RangeStepSize property (ICapabilityRange2 Interface)

RequiredTime Property

RightMargin property (ItwFrame Interface)

SaveTemplate method

SaveTemplateEvent event

SaveTemplateEvent2 event

ScanConfig Property

ScanConfigCount Property

SelectSource method

SelectedFamilyName property

SelectedManufacturerName property

SelectedSourceName property

SetCapability method

SetCapability2 method

ShowTemplateDlg method

SourceCount property

SourceName property

StopFeedPages property

StopFindFastConfig Property

Success property

TopMargin property (ItwFrame Interface)

TransferMode Property (ILTFastConfig)

UserFastConfigs Property

UserFastConfigsCount Property

Version property


Copyright Notice

©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.
1201 Greenwood Cliff, Suite 400
Charlotte, NC 28204

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


Programming with LEADTOOLS Twain COM Object

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

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

Acquiring images from a selected TWAIN source.

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

LEADTOOLS TWAIN COM object must be registered before working with any of the TWAIN properties, methods or events. For more information refer to Registering and Unregistering the TWAIN COM Object.

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 select to use the TWAIN source's default values for the capabilities. LEADTOOLS provides support for working with capabilities in the following ways:

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

Setting or resetting defined values of a specific capability for the selected TWAIN source.

Getting all supported capabilities, and their associated 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.

The user can obtain information from the TWAIN file system, and change the settings within the TWAIN file system. For more information, refer to Getting or Setting TWAIN File System Information.

Save Settings to Files

The user can save the capability settings, used when acquiring images, in a template file. These capability settings can then be loaded 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 TWAIN session is no longer needed, the internal handle should be freed. For more information, refer to Freeing the TWAIN Session.


Registering and Unregistering the TWAIN COM Object

Registering the COM Object

Before the TWAIN COM Object can be used, it must be registered. The installation program automatically registers the LEADTOOLS TWAIN COM Object. If you would like to manually register the object run REGSVR32.EXE found in the BIN directory and pass the name of the object (.DLL) to register as a parameter.

EX.:

REGSVR32 LTRTN14N.DLL will register the LEAD RasterTwain Object Library.

Unregistering the COM Object

To unregister COM Objects, include the "/u" switch before the library name when running REGSVR32.EXE.

EX.:

REGSVR32 /u LTRTN14N.DLL will unregister the LEAD RasterTwain Object Library.


Unlocking Special LEAD Features

The TWAIN features supported in this toolkit are not locked. However, 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 UnlockSupport method 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 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 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 method.


Initializing a TWAIN Session

Before initializing a TWAIN session, the user should set the values of the following optional, application specific properties:

ManName property

ProdFamily property

Version property

AppName property

To begin using the LEADTOOLS TWAIN toolkit, the user must initialize a TWAIN session. This is done by calling the InitSession method after creating the LEADRasterTwain object using the CoCreateInstance function. Each call to the InitSession method will create an internal TWAIN session handle, which is a communication handle between LEADTOOLS TWAIN and a TWAIN driver installed on the system. The InitSession method must be called before calling other LEADTOOLS TWAIN properties, methods or events.

To make the toolkit generate system error events, in addition to error return codes, set the EnableMethodErrors property to TRUE.

After initializing 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 initialized the TWAIN session, the TWAIN source to use for acquiring images should be selected. To determine whether a TWAIN source is available on your system, use the IsAvailable method. If there are TWAIN sources available, you can determine the number of TWAIN sources available on the system using the SourceCount property.

To determine the TWAIN sources available on the system LEADTOOLS provides the SourceName property. This property contains the name of the TWAIN source.

To select the TWAIN source to use for acquiring images, call the SelectSource method. Once a source is selected, the SelectedSourceName property will contain the name of that selected source.

If the source is to be selected without displaying a user interface, you can set the source name using the AcquireSourceName property.

LEADTOOLS provides several properties for getting information about TWAIN source product names and manufacturers names.

The product name of the currently selected TWAIN source can be found in the SelectedFamilyName property. The names of all the TWAIN products available on the system can be found in the FamilyName property.

The manufacturer's name of the currently selected TWAIN source can be found in the SelectedManufacturerName property. The names of the manufacturers of all the TWAIN products available on the system can be found in the ManufacturerName property.

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.


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 options for getting and setting capabilities. The low-level options get and set capabilities individually. The high-level options perform much of the low-level work automatically by interacting with the TWAIN driver directly, allowing the programmer to get and set a series of universal settings common to all TWAIN compliant scanner hardware without having to handle individual capabilities directly. Note that these universal settings do not cover all of the available TWAIN capabilities. Some capabilities can only be retrieved and set using the low-level methods.

Low-Level:

To get information on a specific capability (current, default, or all possible values) call the GetCapability method if you are working in MFC. The capability will be retrieved via a pointer to a created ICapability interface. If you are working in VB, call the GetCapability2 method. The capability will be retrieved via a pointer to a created ILEADTwainCapability interface.

To set a specific capability to a new value or to reset the value of a capability to the default value, call the SetCapability method if you are working in MFC. If you are working in VB, call the SetCapability2 method.

To get all available values for a specific capability supported by the selected TWAIN source, call the QueryCapability method.

To get the number of capabilities supported by the selected TWAIN source, look at the CapsCount property.

To get an array of capabilities supported by the selected TWAIN source, look at he Capability property

High-Level:

The GetProperties method and the SetProperties method allow the user to get and set a series of universal settings that are common to all TWAIN compliant scanner hardware, reducing the need to handle individual capabilities directly. Note that not all capabilities can be changed using the above properties. Depending on the TWAIN source, some capabilities can only be retrieved and set using the low-level GetCapability and SetCapability methods. These two methods set and retrieve the following properties to and from the TWAIN driver:

ImageEffects property: a read-only ILTImageEffects object containing the PixelFlavor, ColorScheme, HighLight, Shadow, Brightness, Contrast, and HalfTone properties. These properties are set to the TWAIN driver through the ImageEffects property when the SetProperties method is called.

DataTransfer property: a read only ILTDataTransfer object containing the FillOrder, BufferMemoryCompression, TransferMode, ScanFileFormat, MemoryBufferSize, EnableSaveMultipageFile, EnableAppendToFile, and EnableDumpMemoryBuffersToFile properties. These properties are set to the TWAIN driver through the DataTransfer property when the SetProperties method is called.

ImageResolution property: a read-only ILTImageResolution object containing the Unit, BitsPerPixel, HorizontalResolution, VerticalResolution, XScaling, YScaling, and RotationAngle properties. These properties are set to the TWAIN driver through the ImageResolution property when the SetProperties method is called.

EnableAutoFeed property: flag indicating whether or not to use the Auto-Feed capability of a selected TWAIN source.

MaxPagesNumber property: determines the maximum number of pages to retrieve from a TWAIN source.

DuplexScanning property: a read-only value that specifies the type of duplex scanning used by a TWAIN source. This value is set by the hardware and cannot be altered by the programmer.

The LeftMargin, RightMargin, TopMargin, and BottomMargin properties: values that determine the left margin, right margin, top margin, and bottom margin, respectively, of the scanning area.

There are several transfer option capabilities that control the transfer mode, file name, file format, and compression. The values for these options are contained in the TransferMode Property, TransferFileName Property, TransferFileFormat Property and TransferCompressionType Property. The current values can be obtained or modified collectively using the SetTransferOptions and the GetTransferOptions methods.

In addition to the transfer options mentioned above, the transfer modes supported by the TWAIN source can be obtained by using IsFileTransferAvailable, IsMemoryTransferAvailable and IsNativeTransferAvailable properties.

When transferring files from the TWAIN source there is a maximum number of files that can be transferred. To get or set the current value, use the MaxXferCount property.

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

XResolution property

YResolution property

ImageFrame property

ImageUnit property

ImageBitsPerPixel property

Image contrast, highlight and brightness capabilities can be obtained or changed using the following properties:

ImageBrightness property

ImageContrast property

ImageHighlight property

The RGB elements used by the TWAIN source are set by calling the SetRGBResponse method. This method uses the values in the following properties to set the current TWAIN source:

RGBElements property

RGBElementsCount property

The RGBElements property contains a pointer to an ITwainRGBElements object that references the following properties:

Index property

Channel1 property

Channel2 property

Channel3 property

These properties must be set before calling the SetRGBResponse method in order to set the RGB elements for the TWAIN source.

If the TWAIN source supports duplex scanning, the duplex mode can be enabled or disabled by setting the EnableDuplex property. To get the current duplex mode, read the DuplexMode property.

The page size and orientation used during image acquisition can be obtained or set by using the following properties:

PaperSize property

PaperDirection property

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

After setting the desired capabilities call the Acquire method to scan the pages.

When setting and getting the capabilities, it may be necessary to create a container associated with that capability. For more information on containers, refer to How to Work with the Containers if you are working in MFC. If you are working in VB, refer to How to Work with Containers – Visual Basic.


How to Work with the Containers - MFC

Due to differences in Visual Basic and MFC, LEADTOOLS provides interfaces specifically for working with containers in MFC. These are discussed here.

When getting or setting capability information, it may be necessary to create a container for the capability. The structure of the container depends on the type of information in the container. LEADTOOLS supports the following types of TWAIN 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.

The LEADTOOLS TWAIN toolkit provides an interface for each container type and the TW_CAPABILITY structure.

The ICapability interface represents the TW_CAPABILITY structure. This interface has two properties that are used in setting and getting the capabilities:

The Capability property contains the capability constant that indicates the specific capability.

ConType property defines the type of the container to use when setting the capability or the container used to get the capability values. The possible container types are defined in the ICapabilityOneValue, ICapabilityEnumeration, ICapabilityArray, and ICapabilityRange interfaces. They can be got by calling the QueryInterface method from the ICapability interface.

The ICapabilityOneValue interface represents a container of type TW_ONEVALUE. This interface has the following properties:

The OneValItemType property contains the type of data contained in the ICapabilityOneValue interface).

The OneValCapValue property contains the actual value of the ICapabilityOneValue interface.

The ICapabilityEnumeration interface represents a container of type TW_ENUMERATION. This interface has the following properties:

The EnumItemType property contains the type of data contained in the ICapabilityEnumeration interface.

The EnumCapValue property contains the actual value(s) of the ICapabilityEnumeration interface.

The EnumNumOfItems property contains the number of values in the ICapabilityEnumeration interface.

The EnumCurrentIndex property contains the index of the current value of the ICapabilityEnumeration interface.

The EnumDefaultIndex property contains the index of the default value of the ICapabilityEnumeration interface.

The ICapabilityRange interface represents a container of type TW_RANGE. This interface has the following properties:

The RangeItemType property contains the type of data contained in the ICapabilityRange interface.

The RangeCurrentValue property contains the current value of the ICapabilityRange interface.

The RangeDefaultValue property contains the default value of the ICapabilityRange interface.

The RangeMinimumValue property contains the minimum value in the range of the ICapabilityRange interface.

The RangeMaximumValue property contains the maximum value in the range of the ICapabilityRange interface.

The RangeStepSize property contains the step size in the range of the ICapabilityRange interface.

The ICapabilityArray interface represents a container of type TW_ARRAY. This interface has the following properties:

The ArrayItemType property contains the type of data contained in the ICapabilityArray interface.

The ArrayCapValue property contains the actual value(s) of the ICapabilityArray interface.

The ArrayNumOfItems property contains the number of items in the ICapabilityArray interface.

The ItwFrame interface represents a structure of type TW_FRAME. It contains information about the area of the image to acquire. This interface has the following properties:

The RightMargin property contains the right margin value.

The LeftMargin property contains the left margin value.

The TopMargin property contains the top margin value.

The BottomMargin property contains the bottom margin value.


How to Work with the Containers – Visual Basic

Due to differences in Visual Basic and MFC, LEADTOOLS provides interfaces specifically for working with containers in VB. These are discussed here.

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

L_TWON_ARRAY

L_TWON_ENUMERATION

L_TWON_ONEVALUE

L_TWON_RANGE

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

The LEADTOOLS TWAIN toolkit provides an interface for each container type and the TW_CAPABILITY structure.

The ILEADTwainCapability interface represents the capabilities; so to get the TW_CAPABILITY, use the CapInfo property, which contains an ICapability2 interface that represents the TW_CAPABILITY structure. This interface has three properties that are used to get and set capabilities:

The Capability property, which contains the capability constant that indicates the specific capability when the capability constant is a short value.

The CapabilityLong property, which contains the capability constant that indicates the specific capability when the capability constant is a short value.

The ConType property, which defines the type of the container to use when setting the capability or the container used to get the capability values. The possible container types are defined in the ICapabilityOneValue2, ICapabilityEnumeration2, ICapabilityArray2, and ICapabilityRange2 interfaces. They can be obtained by using one of the following properties CapArray property, CapEnum property, CapOneValue property and CapRange property.

The ICapabilityOneValue2 interface represents a container of type TW_ONEVALUE. This interface has the following properties:

The OneValItemType property contains the type of data contained in the ICapabilityOneValue2 interface).

The OneValCapValue property contains the actual value of the ICapabilityOneValue2 interface.

The ICapabilityEnumeration2 interface represents a container of type TW_ENUMERATION. This interface has the following properties:

The EnumItemType property contains the type of data contained in the ICapabilityEnumeration2 interface.

The EnumCapValue property contains the actual value(s) of the ICapabilityEnumeration2 interface.

The EnumNumOfItems property contains the number of values in the ICapabilityEnumeration2 interface.

The EnumCurrentIndex property contains the index of the current value of the ICapabilityEnumeration2 interface.

The EnumDefaultIndex property contains the index of the default value of the ICapabilityEnumeration2 interface.

The ICapabilityRange2 interface represents a container of type TW_RANGE. This interface has the following properties:

The RangeItemType property contains the type of data contained in the ICapabilityRange2 interface.

The RangeCurrentValue property contains the current value of the ICapabilityRange2 interface.

The RangeDefaultValue property contains the default value of the ICapabilityRange2 interface.

The RangeMinimumValue property contains the minimum value in the range of the ICapabilityRange2 interface.

The RangeMaximumValue property contains the maximum value in the range of the ICapabilityRange2 interface.

The RangeStepSize property contains the step size in the range of the ICapabilityRange2 interface.

The ICapabilityArray2 interface represents a container of type TW_ARRAY. This interface has the following properties:

The ArrayItemType property contains the type of data contained in the ICapabilityArray2 interface.

The ArrayCapValue property contains the actual value(s) of the ICapabilityArray2 interface.

The ArrayNumOfItems property contains the number of items in the ICapabilityArray2 interface.

The ItwFrame interface represents a structure of type TW_FRAME. It contains information about the area of the image to acquire. This interface has the following properties:

The RightMargin property contains the right margin value.

The LeftMargin property contains the left margin value.

The TopMargin property contains the top margin value.

The BottomMargin property contains the bottom margin value.


How to Acquire from the TWAIN Source

After the user has initialized 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 for acquiring images and image data from a TWAIN source:

The Acquire method acquires one or more images from a TWAIN source. For each image acquired by the Acquire method, an AcquirePageEvent event occurs and the image is passed to the event. Within the AcquirePageEvent event the user can call the GetExtImageInfo method to get extended image information that is included if the TWAIN source is a barcode reader or a digital camera.

If you are using the ADF, you can stop feeding pages during the acquisition process by setting the StopFeedPages property value to TRUE in the AcquirePageEvent event. To continue feeding pages during image acquisition, set this property value to FALSE.

The GetExtImageInfo method will store the acquired image information in a pointer to an ItwExtImageInfo interface. This interface has the following properties:

The NumOfInfos property contains the number of entries in the PtwInfo property.

The PtwInfo property is an array of ItwInfo interfaces describing the extended image information retrieved.

The ItwInfo is an interface used in getting information data from an ItwExtImageInfo interface. It has the following properties:

The InfoID property contains the extended image information ID.

The ItemType property contains the data type of the extended information.

The NumOfItems property contains the number of items retrieved for the extended image information.

The CondCode property contains the condition code obtained when getting the extended image information value.

The Item property contains a VARIANT array that contains the extended image information.

The AcquireMulti method acquires one or more images from a TWAIN source and saves the image(s) to one or more files. Several properties are associated with this method and help control the performance of this method, and the TWAIN driver. These properties are: FastTransferMode property, the FastFormat property, the FastBitsPerPixel property, the FastBufferSize property and the FastUsePreferredBufferSize property.

In addition, the parameters passed to the AcquireMulti method dictate the actions of the method. 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 bMulti 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.

For each page scanned using the AcquireMulti method, the AcquireMultiEvent event is fired twice, if the EnableAcquireMultiEvent property is set to TRUE before calling the AcquireMulti method. The AcquireMultiEvent event is fired first when the Twain source begins scanning the page. The event is fired the second time when the Twain source finishes scanning the page.

The Acquire method 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.

The following properties are used depending on the transfer mode set.:

The FileTransferName property contains the file name that will be used when the transfer mode is set to File.

The MemBufSize property contains the memory buffer size to use when the transfer mode is set to Memory Buffered.


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 for working with template files:

The ShowTemplateDlg method 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. Before calling this method you can determine which user interface to display by setting the EnableShowUserInterfaceOnly property.

To get all the supported capability values set by the selected TWAIN source and save them to the specified file, call the SaveTemplate method. The SaveTemplateEvent event or SaveTemplateEvent2 event will occur after each capability is obtained from the TWAIN source, but before it is saved in the template file. This allows the user to change the value. The SaveTemplateEvent2 event will occur only if the EnableSaveTemplateEvent property has been set to TRUE. The SaveTemplateEvent event is designed more for MFC users, and takes as a parameter a pointer to an ICapability interface that references the capability values to be saved. The SaveTemplateEvent2 event is for VB users, and takes as a parameter a pointer to an ILEADTwainCapability interface that references the capability values to be saved.

To load the TWAIN capability values stored in the specified template file and set the selected TWAIN source using these values, call the LoadTemplate method. The LoadTemplateEvent event or LoadTemplateEvent2 event will occur after each capability has been obtained from the file, but before it is set in the TWAIN source. This allows the user to change the value. The LoadTemplateEvent2 event will occur only if the EnableLoadTemplateEvent property has been set to TRUE. The LoadTemplateEvent event is designed more for MFC users, and takes as a parameter a pointer to an ICapability interface, that references the capability values loaded from the file. The LoadTemplateEvent2 event is for VB users, and takes as a parameter a pointer to an ILEADTwainCapability interface, that references the capability values loaded from the file.


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 the FindFastConfig method. This method 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 UserFastConfigsCount property. For each scan configuration that is tested, the FastConfigEvent event is fired, if the EnableFastConfigEvent property has been set to TRUE. This event receives the information for the scan configuration being tested. This lets you interact with the scan configuration information as needed. When the FastConfigEvent event is fired, you can check the success status of the scan configuration being tested by getting the Success property.

The scan configuration testing process, started by the FindFastConfig method, can be stopped by setting the StopFindFastConfig property to TRUE. To continue the scan configuration process, set the StopFindFastConfig property to FALSE.

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 GetScanConfigs method. This method 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 in the ScanConfig property and get the number of scan configurations in the ScanConfigCount property, assign the value of the ScanConfigCount property to the UserFastConfigsCount property and assign scan configurations in the ScanConfig property to the UserFastConfigs property and then call the FindFastConfig method. This will decrease the number of default scan configurations that must be tested. The scan configurations that are actually tested by the FindFastConfig method are placed in the FastConfigsResult property. The number of scan configurations tested is placed in the FastConfigsResultCount property.

Once the best scan configuration has been determined, the scan configuration information in the BestFastConfig property can be used to set the values for the FastTransferMode property, the FastFormat property, the FastBitsPerPixel property, FastBufferSize property and the FastUsePreferredBufferSize property. Then the AcquireMulti method can be called so the images will be acquired as fast as possible.

Scan configurations are accessed through an ILTFastConfig interface, which contains the following properties: BitsPerPixel property, BufferSize property, FileFormat property, RequiredTime property and the TransferMode property.


Freeing the TWAIN Session

When the TWAIN session is no longer needed, the user must free the internal handle by calling the EndSession method. At this point the internal TWAIN handle becomes invalid. Before acquiring any more images from a TWAIN source, the user must initialize a new internal TWAIN handle by calling the InitSession method.


Getting or Setting TWAIN File System Information

LEADTOOLS provides the ability to obtain information from the TWAIN file system, and change settings within the TWAIN file system using the QueryFileSystem method and the FileSystemInfo property.

The user can direct the TWAIN file system to perform a specific action like, change a device, domain, host, or image directory; create an image directory; delete an image or an image directory; format a storage device; rename an image or an image directory; or copy images across storage devices. The user can also direct the TWAIN file system to retrieve certain information or items such as, information on the current file, the next file in the directory, the first file in the directory, etc.

The FileSystemInfo interface accesses numerous properties that are either updated by the QueryFileSystem method, or used by the QueryFileSystem method to change settings within the TWAIN file system. These properties are:

CreateTimeDate property

DeviceGroupMask property

FileSize property

FileType property

FreeMediaSpace property

InputName property

ModifiedTimeDate property

NewImageSize property

NumberOfAudioSnippets property

NumberOfFiles property

OutputName property

Recursive property

If the FileMsg parameter of the QueryFileSystem method contains one of the following flags:

FILESYSTEM_MSG_CHANGEDIRECTORY

FILESYSTEM_MSG_CREATEDIRECTORY

FILESYSTEM_MSG_DELETE

FILESYSTEM_MSG_FORMATMEDIA

FILESYSTEM_MSG_RENAME

FILESYSTEM_MSG_COPY

certain properties of the interface pointed to by the FileSystemInfo property must contain the proper information before calling this method. This method will use the provided information to change settings within the TWAIN file system.

If the FileMsg parameter of the QueryFileSystem method contains one of the following flags:

FILESYSTEM_MSG_GETCLOSE

FILESYSTEM_MSG_GETFIRSTFILE

FILESYSTEM_MSG_GETINFO

FILESYSTEM_MSG_GETNEXTFILE

this method, will update certain properties of the interface pointed to by the FileSystemInfo property with the corresponding information.

If the FileMsg parameter of the QueryFileSystem method contains the following flag:

FILESYSTEM_MSG_AUTOMATICCAPTUREDIRECTORY

this method will use information stored within certain properties of the interface pointed to by the FileSystemInfo property and will update certain properties of the interface pointed to by the FileSystemInfo property with any appropriate information.


Using JPEG Compression for a TWAIN Source

LEADTOOLS provides the functionality to get and set JPEG compression options for a TWAIN source. The user can get the current or default JPEG compression options for the current TWAIN session by calling the GetJPEGCompression method.

The GetJPEGCompression method updates the JPEGCompressionData property. The JPEGCompressionData property is a pointer to an ITwainJpegCompression object, which contains the following properties:

ColorSpace property

HuffmanAC property

HuffmanDC property

HuffmanMap property

NumComponents property

QuantMap property

QuantTable property

RestartFrequency property

SubSampling property

To set the JPEG Compression options for the current TWAIN session, set the properties listed above, accessed through the JPEGCompressionData property, and then call the SetJPEGCompression method.

The QuantTable, HuffmanDC and HuffmanAC properties, listed above, are each pointers to an array of ITwainMemoryData objects. Each ITwainMemoryData object contains the following properties:

Flags property

Length property

Data property

These properties are updated through the QuantTable, HuffmanDC and HuffmanAC properties when the GetJPEGCompression method is called.

For the QuantTable, HuffmanDC and HuffmanAC properties, set the properties listed above for each entry in the array, before calling the SetJPEGCompression method.


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 TWAIN features is created:

REDIST\

Redistributable TWAIN features files.

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.

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 LTR and LTRVR are required for all COM applications. For more information on LTR, LTRVR, or other files for the Main COM objects, 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:
LTRTN LTRTW | ILEADRasterTwain, TWAIN support. The LTRTN DLL is used with the other COM Objects. The LTRTW DLL is used with ActiveX Controls. Information on the ILEADRasterTwain Object can now be found in the LEADTOOLS TWAIN COM Help File (Lttwncomn.hlp) in the HELP directory. Your installation procedure must register the COM Object DLL. | DLL: LTRTN14N.DLL LTRTW14N.DLL | DLL: LTRTN14NU.DLL Unicode is not supported for ActiveX. | DLL: LTRTN14E.DLL LTRTW14E.DLL | DLL: LTRTN14EU.DLL Unicode is not supported for ActiveX.


Installation Directory

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.

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.
IMAGES | Sample images and databases containing images.
EXAMPLES\COM | One subdirectory for each example COM 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.
REDIST\COM | Redistributable files. These are copies of the LEADTOOLS COM Object 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.
REDIST\COM\NONAG | This directory contains the LEADRaster COM Object DLL that must be distributed with your application.


LEADTOOLS Documentation

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.


LEADTOOLS TWAIN Defines

LEADTOOLS provides the user with defines are equivalent to the original TWAIN defines.

The following table lists each of the original TWAIN constants, along with its corresponding LEADTOOLS equivalent.

Original Twain Constant

LEADTOOLS Equivalent Constant

Twain Container Types

TWON_ARRAY | L_TWON_ARRAY
TWON_ENUMERATION | L_TWON_ENUMERATION
TWON_ONEVALUE | L_TWON_ONEVALUE
TWON_RANGE | L_TWON_RANGE
TWON_ICONID | L_TWON_ICONID
TWON_DSMID | L_TWON_DSMID
TWON_DSMCODEID | L_TWON_DSMCODEID
TWON_DONTCARE8 | L_TWON_DONTCARE8
TWON_DONTCARE16 | L_TWON_DONTCARE16
TWON_DONTCARE32 | L_TWON_DONTCARE32

Twain Item Types

TWTY_INT8 | L_TWTY_INT8
TWTY_INT16 | L_TWTY_INT16
TWTY_INT32 | L_TWTY_INT32
TWTY_UINT8 | L_TWTY_UINT8
TWTY_UINT16 | L_TWTY_UINT16
TWTY_UINT32 | L_TWTY_UINT32
TWTY_BOOL | L_TWTY_BOOL
TWTY_FIX32 | L_TWTY_FIX32
TWTY_FRAME | L_TWTY_FRAME
TWTY_STR32 | L_TWTY_STR32
TWTY_STR64 | L_TWTY_STR64
TWTY_STR128 | L_TWTY_STR128
TWTY_STR255 | L_TWTY_STR255
TWTY_STR1024 | L_TWTY_STR1024
TWTY_UNI512 | L_TWTY_UNI512

Twain Bit Order

TWBO_LSBFIRST | L_TWBO_LSBFIRST
TWBO_MSBFIRST | L_TWBO_MSBFIRST

Twain Compression

TWCP_NONE | L_TWCP_NONE
TWCP_PACKBITS | L_TWCP_PACKBITS
TWCP_GROUP31D | L_TWCP_GROUP31D
TWCP_GROUP31DEOL | L_TWCP_GROUP31DEOL
TWCP_GROUP32D | L_TWCP_GROUP32D
TWCP_GROUP4 | L_TWCP_GROUP4
TWCP_JPEG | L_TWCP_JPEG
TWCP_LZW | L_TWCP_LZW
TWCP_JBIG | L_TWCP_JBIG
TWCP_PNG | L_TWCP_PNG
TWCP_RLE4 | L_TWCP_RLE4
TWCP_RLE8 | L_TWCP_RLE8
TWCP_BITFIELDS | L_TWCP_BITFIELDS

Twain File Formats

TWFF_TIFF | L_TWFF_TIFF
TWFF_PICT | L_TWFF_PICT
TWFF_BMP | L_TWFF_BMP
TWFF_XBM | L_TWFF_XBM
TWFF_JFIF | L_TWFF_JFIF
TWFF_FPX | L_TWFF_FPX
TWFF_TIFFMULTI | L_TWFF_TIFFMULTI
TWFF_PNG | L_TWFF_PNG
TWFF_SPIFF | L_TWFF_SPIFF
TWFF_EXIF | L_TWFF_EXIF

Twain Filters

TWFT_RED | L_TWFT_RED
TWFT_GREEN | L_TWFT_GREEN
TWFT_BLUE | L_TWFT_BLUE
TWFT_NONE | L_TWFT_NONE
TWFT_WHITE | L_TWFT_WHITE
TWFT_CYAN | L_TWFT_CYAN
TWFT_MAGENTA | L_TWFT_MAGENTA
TWFT_YELLOW | L_TWFT_YELLOW
TWFT_BLACK | L_TWFT_BLACK

Twain Light Path

TWLP_REFLECTIVE | L_TWLP_REFLECTIVE
TWLP_TRANSMISSIVE | L_TWLP_TRANSMISSIVE

Twain Light Source

TWLS_RED | L_TWLS_RED
TWLS_GREEN | L_TWLS_GREEN
TWLS_BLUE | L_TWLS_BLUE
TWLS_NONE | L_TWLS_NONE
TWLS_WHITE | L_TWLS_WHITE
TWLS_UV | L_TWLS_UV
TWLS_IR | L_TWLS_IR

Twain Orientation

TWOR_ROT0 | L_TWOR_ROT0
TWOR_ROT90 | L_TWOR_ROT90
TWOR_ROT180 | L_TWOR_ROT180
TWOR_ROT270 | L_TWOR_ROT270
TWOR_PORTRAIT | L_TWOR_PORTRAIT
TWOR_LANDSCAPE | L_TWOR_LANDSCAPE

Twain Planar Chunky

TWPC_CHUNKY | L_TWPC_CHUNKY
TWPC_PLANAR | L_TWPC_PLANAR

Twain Pixel Flavor

TWPF_CHOCOLATE | L_TWPF_CHOCOLATE
TWPF_VANILLA | L_TWPF_VANILLA

Twain Pixel Types

TWPT_BW | L_TWPT_BW
TWPT_GRAY | L_TWPT_GRAY
TWPT_RGB | L_TWPT_RGB
TWPT_PALETTE | L_TWPT_PALETTE
TWPT_CMY | L_TWPT_CMY
TWPT_CMYK | L_TWPT_CMYK
TWPT_YUV | L_TWPT_YUV
TWPT_YUVK | L_TWPT_YUVK
TWPT_CIEXYZ | L_TWPT_CIEXYZ

Twain Supported Sizes

TWSS_NONE | L_TWSS_NONE
TWSS_A4LETTER | L_TWSS_A4LETTER
TWSS_B5LETTER | L_TWSS_B5LETTER
TWSS_USLETTER | L_TWSS_USLETTER
TWSS_USLEGAL | L_TWSS_USLEGAL
TWSS_A5 | L_TWSS_A5
TWSS_B4 | L_TWSS_B4
TWSS_B6 | L_TWSS_B6
TWSS_USLEDGER | L_TWSS_USLEDGER
TWSS_USEXECUTIVE | L_TWSS_USEXECUTIVE
TWSS_A3 | L_TWSS_A3
TWSS_B3 | L_TWSS_B3
TWSS_A6 | L_TWSS_A6
TWSS_C4 | L_TWSS_C4
TWSS_C5 | L_TWSS_C5
TWSS_C6 | L_TWSS_C6
TWSS_4A0 | L_TWSS_4A0
TWSS_2A0 | L_TWSS_2A0
TWSS_A0 | L_TWSS_A0
TWSS_A1 | L_TWSS_A1
TWSS_A2 | L_TWSS_A2
TWSS_A4 | L_TWSS_A4
TWSS_A7 | L_TWSS_A7
TWSS_A8 | L_TWSS_A8
TWSS_A9 | L_TWSS_A9
TWSS_A10 | L_TWSS_A10
TWSS_ISOB0 | L_TWSS_ISOB0
TWSS_ISOB1 | L_TWSS_ISOB1
TWSS_ISOB2 | L_TWSS_ISOB2
TWSS_ISOB3 | L_TWSS_ISOB3
TWSS_ISOB4 | L_TWSS_ISOB4
TWSS_ISOB5 | L_TWSS_ISOB5
TWSS_ISOB6 | L_TWSS_ISOB6
TWSS_ISOB7 | L_TWSS_ISOB7
TWSS_ISOB8 | L_TWSS_ISOB8
TWSS_ISOB9 | L_TWSS_ISOB9
TWSS_ISOB10 | L_TWSS_ISOB10
TWSS_JISB0 | L_TWSS_JISB0
TWSS_JISB1 | L_TWSS_JISB1
TWSS_JISB2 | L_TWSS_JISB2
TWSS_JISB3 | L_TWSS_JISB3
TWSS_JISB4 | L_TWSS_JISB4
TWSS_JISB5 | L_TWSS_JISB5
TWSS_JISB6 | L_TWSS_JISB6
TWSS_JISB7 | L_TWSS_JISB7
TWSS_JISB8 | L_TWSS_JISB8
TWSS_JISB9 | L_TWSS_JISB9
TWSS_JISB10 | L_TWSS_JISB10
TWSS_C0 | L_TWSS_C0
TWSS_C1 | L_TWSS_C1
TWSS_C2 | L_TWSS_C2
TWSS_C3 | L_TWSS_C3
TWSS_C7 | L_TWSS_C7
TWSS_C8 | L_TWSS_C8
TWSS_C9 | L_TWSS_C9
TWSS_C10 | L_TWSS_C10
TWSS_USSTATEMENT | L_TWSS_USSTATEMENT
TWSS_BUSINESSCARD | L_TWSS_BUSINESSCARD

Twain Transfer Mechanism

TWSX_NATIVE | L_TWSX_NATIVE
TWSX_FILE | L_TWSX_FILE
TWSX_MEMORY | L_TWSX_MEMORY
TWSX_FILE2 | L_TWSX_FILE2

Twain Units

TWUN_INCHES | L_TWUN_INCHES
TWUN_CENTIMETERS | L_TWUN_CENTIMETERS
TWUN_PICAS | L_TWUN_PICAS
TWUN_POINTS | L_TWUN_POINTS
TWUN_TWIPS | L_TWUN_TWIPS
TWUN_PIXELS | L_TWUN_PIXELS

Twain Bit Depth Reduction

TWBR_THRESHOLD | L_TWBR_THRESHOLD
TWBR_HALFTONE | L_TWBR_HALFTONE
TWBR_CUSTHALFTONE | L_TWBR_CUSTHALFTONE
TWBR_DIFFUSION | L_TWBR_DIFFUSION

Twain Duplex

TWDX_NONE | L_TWDX_NONE
TWDX_1PASSDUPLEX | L_TWDX_1PASSDUPLEX
TWDX_2PASSDUPLEX | L_TWDX_2PASSDUPLEX

Twain BarCode Types

TWBT_3OF9 | L_TWBT_3OF9
TWBT_2OF5INTERLEAVED | L_TWBT_2OF5INTERLEAVED
TWBT_2OF5NONINTERLEAVED | L_TWBT_2OF5NONINTERLEAVED
TWBT_CODE93 | L_TWBT_CODE93
TWBT_CODE128 | L_TWBT_CODE128
TWBT_UCC128 | L_TWBT_UCC128
TWBT_CODABAR | L_TWBT_CODABAR
TWBT_UPCA | L_TWBT_UPCA
TWBT_UPCE | L_TWBT_UPCE
TWBT_EAN8 | L_TWBT_EAN8
TWBT_EAN13 | L_TWBT_EAN13
TWBT_POSTNET | L_TWBT_POSTNET
TWBT_PDF417 | L_TWBT_PDF417
TWBT_2OF5INDUSTRIAL | L_TWBT_2OF5INDUSTRIAL
TWBT_2OF5MATRIX | L_TWBT_2OF5MATRIX
TWBT_2OF5DATALOGIC | L_TWBT_2OF5DATALOGIC
TWBT_2OF5IATA | L_TWBT_2OF5IATA
TWBT_3OF9FULLASCII | L_TWBT_3OF9FULLASCII
TWBT_CODABARWITHSTARTSTOP | L_TWBT_CODABARWITHSTARTSTOP
TWBT_MAXICODE | L_TWBT_MAXICODE

Twain Deskew

TWDSK_SUCCESS | L_TWDSK_SUCCESS
TWDSK_REPORTONLY | L_TWDSK_REPORTONLY
TWDSK_FAIL | L_TWDSK_FAIL
TWDSK_DISABLED | L_TWDSK_DISABLED

Twain Patch Code

TWPCH_PATCH1 | L_TWPCH_PATCH1
TWPCH_PATCH2 | L_TWPCH_PATCH2
TWPCH_PATCH3 | L_TWPCH_PATCH3
TWPCH_PATCH4 | L_TWPCH_PATCH4
TWPCH_PATCH6 | L_TWPCH_PATCH6
TWPCH_PATCHT | L_TWPCH_PATCHT

Twain Job Control

TWJC_NONE | L_TWJC_NONE
TWJC_JSIC | L_TWJC_JSIC
TWJC_JSIS | L_TWJC_JSIS
TWJC_JSXC | L_TWJC_JSXC
TWJC_JSXS | L_TWJC_JSXS

Twain BarCode Rotation

TWBCOR_ROT0 | L_TWBCOR_ROT0
TWBCOR_ROT90 | L_TWBCOR_ROT90
TWBCOR_ROT180 | L_TWBCOR_ROT180
TWBCOR_ROT270 | L_TWBCOR_ROT270
TWBCOR_ROTX | L_TWBCOR_ROTX

Twain Audio File Format

TWAF_WAV | L_TWAF_WAV
TWAF_AIFF | L_TWAF_AIFF
TWAF_AU | L_TWAF_AU
TWAF_SND | L_TWAF_SND

Twain Alarm

TWAL_ALARM | L_TWAL_ALARM
TWAL_FEEDERERROR | L_TWAL_FEEDERERROR
TWAL_FEEDERWARNING | L_TWAL_FEEDERWARNING
TWAL_BARCODE | L_TWAL_BARCODE
TWAL_DOUBLEFEED | L_TWAL_DOUBLEFEED
TWAL_JAM | L_TWAL_JAM
TWAL_PATCHCODE | L_TWAL_PATCHCODE
TWAL_POWER | L_TWAL_POWER
TWAL_SKEW | L_TWAL_SKEW

Twain Clear Buffer

TWCB_AUTO | L_TWCB_AUTO
TWCB_CLEAR | L_TWCB_CLEAR
TWCB_NOCLEAR | L_TWCB_NOCLEAR

Twain Device Event

TWDE_CUSTOMEVENTS | L_TWDE_CUSTOMEVENTS
TWDE_CHECKAUTOMATICCAPTURE | L_TWDE_CHECKAUTOMATICCAPTURE
TWDE_CHECKBATTERY | L_TWDE_CHECKBATTERY
TWDE_CHECKDEVICEONLINE | L_TWDE_CHECKDEVICEONLINE
TWDE_CHECKFLASH | L_TWDE_CHECKFLASH
TWDE_CHECKPOWERSUPPLY | L_TWDE_CHECKPOWERSUPPLY
TWDE_CHECKRESOLUTION | L_TWDE_CHECKRESOLUTION
TWDE_DEVICEADDED | L_TWDE_DEVICEADDED
TWDE_DEVICEOFFLINE | L_TWDE_DEVICEOFFLINE
TWDE_DEVICEREADY | L_TWDE_DEVICEREADY
TWDE_DEVICEREMOVED | L_TWDE_DEVICEREMOVED
TWDE_IMAGECAPTURED | L_TWDE_IMAGECAPTURED
TWDE_IMAGEDELETED | L_TWDE_IMAGEDELETED
TWDE_PAPERDOUBLEFEED | L_TWDE_PAPERDOUBLEFEED
TWDE_PAPERJAM | L_TWDE_PAPERJAM
TWDE_LAMPFAILURE | L_TWDE_LAMPFAILURE
TWDE_POWERSAVE | L_TWDE_POWERSAVE
TWDE_POWERSAVENOTIFY | L_TWDE_POWERSAVENOTIFY

Twain Feeder Alignment

TWFA_NONE | L_TWFA_NONE
TWFA_LEFT | L_TWFA_LEFT
TWFA_CENTER | L_TWFA_CENTER
TWFA_RIGHT | L_TWFA_RIGHT

Twain Feeder Order

TWFO_FIRSTPAGEFIRST | L_TWFO_FIRSTPAGEFIRST
TWFO_LASTPAGEFIRST | L_TWFO_LASTPAGEFIRST

Twain File System

TWFS_FILESYSTEM | L_TWFS_FILESYSTEM
TWFS_RECURSIVEDELETE | L_TWFS_RECURSIVEDELETE

Twain Power Supply

TWPS_EXTERNAL | L_TWPS_EXTERNAL
TWPS_BATTERY | L_TWPS_BATTERY

Twain Printer

TWPR_IMPRINTERTOPBEFORE | L_TWPR_IMPRINTERTOPBEFORE
TWPR_IMPRINTERTOPAFTER | L_TWPR_IMPRINTERTOPAFTER
TWPR_IMPRINTERBOTTOMBEFORE | L_TWPR_IMPRINTERBOTTOMBEFORE
TWPR_IMPRINTERBOTTOMAFTER | L_TWPR_IMPRINTERBOTTOMAFTER
TWPR_ENDORSERTOPBEFORE | L_TWPR_ENDORSERTOPBEFORE
TWPR_ENDORSERTOPAFTER | L_TWPR_ENDORSERTOPAFTER
TWPR_ENDORSERBOTTOMBEFORE | L_TWPR_ENDORSERBOTTOMBEFORE
TWPR_ENDORSERBOTTOMAFTER | L_TWPR_ENDORSERBOTTOMAFTER

Twain Printer Mode

TWPM_SINGLESTRING | L_TWPM_SINGLESTRING
TWPM_MULTISTRING | L_TWPM_MULTISTRING
TWPM_COMPOUNDSTRING | L_TWPM_COMPOUNDSTRING

Twain BarCode Search Mode

TWBD_HORZ | L_TWBD_HORZ
TWBD_VERT | L_TWBD_VERT
TWBD_HORZVERT | L_TWBD_HORZVERT
TWBD_VERTHORZ | L_TWBD_VERTHORZ

Twain Flash Used

TWFL_NONE | L_TWFL_NONE
TWFL_OFF | L_TWFL_OFF
TWFL_ON | L_TWFL_ON
TWFL_AUTO | L_TWFL_AUTO
TWFL_REDEYE | L_TWFL_REDEYE

Twain Flip Rotation

TWFR_BOOK | L_TWFR_BOOK
TWFR_FANFOLD | L_TWFR_FANFOLD

Twain Image Filter

TWIF_NONE | L_TWIF_NONE
TWIF_AUTO | L_TWIF_AUTO
TWIF_LOWPASS | L_TWIF_LOWPASS
TWIF_BANDPASS | L_TWIF_BANDPASS
TWIF_HIGHPASS | L_TWIF_HIGHPASS
TWIF_TEXT | L_TWIF_TEXT
TWIF_FINELINE | L_TWIF_FINELINE

Twain Noise Filter

TWNF_NONE | L_TWNF_NONE
TWNF_AUTO | L_TWNF_AUTO
TWNF_LONEPIXEL | L_TWNF_LONEPIXEL
TWNF_MAJORITYRULE | L_TWNF_MAJORITYRULE

Twain Over Scan

TWOV_NONE | L_TWOV_NONE
TWOV_AUTO | L_TWOV_AUTO
TWOV_TOPBOTTOM | L_TWOV_TOPBOTTOM
TWOV_LEFTRIGHT | L_TWOV_LEFTRIGHT
TWOV_ALL | L_TWOV_ALL

Twain File System

TWFY_CAMERA | L_TWFY_CAMERA
TWFY_CAMERATOP | L_TWFY_CAMERATOP
TWFY_CAMERABOTTOM | L_TWFY_CAMERABOTTOM
TWFY_CAMERAPREVIEW | L_TWFY_CAMERAPREVIEW
TWFY_DOMAIN | L_TWFY_DOMAIN
TWFY_HOST | L_TWFY_HOST
TWFY_DIRECTORY | L_TWFY_DIRECTORY
TWFY_IMAGE | L_TWFY_IMAGE
TWFY_UNKNOWN | L_TWFY_UNKNOWN

Twain Jpeg Quality

TWJQ_UNKNOWN | L_TWJQ_UNKNOWN
TWJQ_LOW | L_TWJQ_LOW
TWJQ_MEDIUM | L_TWJQ_MEDIUM
TWJQ_HIGH | L_TWJQ_HIGH

Twain Country

TWCY_AFGHANISTAN | L_TWCY_AFGHANISTAN
TWCY_ALGERIA | L_TWCY_ALGERIA
TWCY_AMERICANSAMOA | L_TWCY_AMERICANSAMOA
TWCY_ANDORRA | L_TWCY_ANDORRA
TWCY_ANGOLA | L_TWCY_ANGOLA
TWCY_ANGUILLA | L_TWCY_ANGUILLA
TWCY_ANTIGUA | L_TWCY_ANTIGUA
TWCY_ARGENTINA | L_TWCY_ARGENTINA
TWCY_ARUBA | L_TWCY_ARUBA
TWCY_ASCENSIONI | L_TWCY_ASCENSIONI
TWCY_AUSTRALIA | L_TWCY_AUSTRALIA
TWCY_AUSTRIA | L_TWCY_AUSTRIA
TWCY_BAHAMAS | L_TWCY_BAHAMAS
TWCY_BAHRAIN | L_TWCY_BAHRAIN
TWCY_BANGLADESH | L_TWCY_BANGLADESH
TWCY_BARBADOS | L_TWCY_BARBADOS
TWCY_BELGIUM | L_TWCY_BELGIUM
TWCY_BELIZE | L_TWCY_BELIZE
TWCY_BENIN | L_TWCY_BENIN
TWCY_BERMUDA | L_TWCY_BERMUDA
TWCY_BHUTAN | L_TWCY_BHUTAN
TWCY_BOLIVIA | L_TWCY_BOLIVIA
TWCY_BOTSWANA | L_TWCY_BOTSWANA
TWCY_BRITAIN | L_TWCY_BRITAIN
TWCY_BRITVIRGINIS | L_TWCY_BRITVIRGINIS
TWCY_BRAZIL | L_TWCY_BRAZIL
TWCY_BRUNEI | L_TWCY_BRUNEI
TWCY_BULGARIA | L_TWCY_BULGARIA
TWCY_BURKINAFASO | L_TWCY_BURKINAFASO
TWCY_BURMA | L_TWCY_BURMA
TWCY_BURUNDI | L_TWCY_BURUNDI
TWCY_CAMAROON | L_TWCY_CAMAROON
TWCY_CANADA | L_TWCY_CANADA
TWCY_CAPEVERDEIS | L_TWCY_CAPEVERDEIS
TWCY_CAYMANIS | L_TWCY_CAYMANIS
TWCY_CENTRALAFREP | L_TWCY_CENTRALAFREP
TWCY_CHAD | L_TWCY_CHAD
TWCY_CHILE | L_TWCY_CHILE
TWCY_CHINA | L_TWCY_CHINA
TWCY_CHRISTMASIS | L_TWCY_CHRISTMASIS
TWCY_COCOSIS | L_TWCY_COCOSIS
TWCY_COLOMBIA | L_TWCY_COLOMBIA
TWCY_COMOROS | L_TWCY_COMOROS
TWCY_CONGO | L_TWCY_CONGO
TWCY_COOKIS | L_TWCY_COOKIS
TWCY_COSTARICA | L_TWCY_COSTARICA
TWCY_CUBA | L_TWCY_CUBA
TWCY_CYPRUS | L_TWCY_CYPRUS
TWCY_CZECHOSLOVAKIA | L_TWCY_CZECHOSLOVAKIA
TWCY_DENMARK | L_TWCY_DENMARK
TWCY_DJIBOUTI | L_TWCY_DJIBOUTI
TWCY_DOMINICA | L_TWCY_DOMINICA
TWCY_DOMINCANREP | L_TWCY_DOMINCANREP
TWCY_EASTERIS | L_TWCY_EASTERIS
TWCY_ECUADOR | L_TWCY_ECUADOR
TWCY_EGYPT | L_TWCY_EGYPT
TWCY_ELSALVADOR | L_TWCY_ELSALVADOR
TWCY_EQGUINEA | L_TWCY_EQGUINEA
TWCY_ETHIOPIA | L_TWCY_ETHIOPIA
TWCY_FALKLANDIS | L_TWCY_FALKLANDIS
TWCY_FAEROEIS | L_TWCY_FAEROEIS
TWCY_FIJIISLANDS | L_TWCY_FIJIISLANDS
TWCY_FINLAND | L_TWCY_FINLAND
TWCY_FRANCE | L_TWCY_FRANCE
TWCY_FRANTILLES | L_TWCY_FRANTILLES
TWCY_FRGUIANA | L_TWCY_FRGUIANA
TWCY_FRPOLYNEISA | L_TWCY_FRPOLYNEISA
TWCY_FUTANAIS | L_TWCY_FUTANAIS
TWCY_GABON | L_TWCY_GABON
TWCY_GAMBIA | L_TWCY_GAMBIA
TWCY_GERMANY | L_TWCY_GERMANY
TWCY_GHANA | L_TWCY_GHANA
TWCY_GIBRALTER | L_TWCY_GIBRALTER
TWCY_GREECE | L_TWCY_GREECE
TWCY_GREENLAND | L_TWCY_GREENLAND
TWCY_GRENADA | L_TWCY_GRENADA
TWCY_GRENEDINES | L_TWCY_GRENEDINES
TWCY_GUADELOUPE | L_TWCY_GUADELOUPE
TWCY_GUAM | L_TWCY_GUAM
TWCY_GUANTANAMOBAY | L_TWCY_GUANTANAMOBAY
TWCY_GUATEMALA | L_TWCY_GUATEMALA
TWCY_GUINEA | L_TWCY_GUINEA
TWCY_GUINEABISSAU | L_TWCY_GUINEABISSAU
TWCY_GUYANA | L_TWCY_GUYANA
TWCY_HAITI | L_TWCY_HAITI
TWCY_HONDURAS | L_TWCY_HONDURAS
TWCY_HONGKONG | L_TWCY_HONGKONG
TWCY_HUNGARY | L_TWCY_HUNGARY
TWCY_ICELAND | L_TWCY_ICELAND
TWCY_INDIA | L_TWCY_INDIA
TWCY_INDONESIA | L_TWCY_INDONESIA
TWCY_IRAN | L_TWCY_IRAN
TWCY_IRAQ | L_TWCY_IRAQ
TWCY_IRELAND | L_TWCY_IRELAND
TWCY_ISRAEL | L_TWCY_ISRAEL
TWCY_ITALY | L_TWCY_ITALY
TWCY_IVORYCOAST | L_TWCY_IVORYCOAST
TWCY_JAMAICA | L_TWCY_JAMAICA
TWCY_JAPAN | L_TWCY_JAPAN
TWCY_JORDAN | L_TWCY_JORDAN
TWCY_KENYA | L_TWCY_KENYA
TWCY_KIRIBATI | L_TWCY_KIRIBATI
TWCY_KOREA | L_TWCY_KOREA
TWCY_KUWAIT | L_TWCY_KUWAIT
TWCY_LAOS | L_TWCY_LAOS
TWCY_LEBANON | L_TWCY_LEBANON
TWCY_LIBERIA | L_TWCY_LIBERIA
TWCY_LIBYA | L_TWCY_LIBYA
TWCY_LIECHTENSTEIN | L_TWCY_LIECHTENSTEIN
TWCY_LUXENBOURG | L_TWCY_LUXENBOURG
TWCY_MACAO | L_TWCY_MACAO
TWCY_MADAGASCAR | L_TWCY_MADAGASCAR
TWCY_MALAWI | L_TWCY_MALAWI
TWCY_MALAYSIA | L_TWCY_MALAYSIA
TWCY_MALDIVES | L_TWCY_MALDIVES
TWCY_MALI | L_TWCY_MALI
TWCY_MALTA | L_TWCY_MALTA
TWCY_MARSHALLIS | L_TWCY_MARSHALLIS
TWCY_MAURITANIA | L_TWCY_MAURITANIA
TWCY_MAURITIUS | L_TWCY_MAURITIUS
TWCY_MEXICO | L_TWCY_MEXICO
TWCY_MICRONESIA | L_TWCY_MICRONESIA
TWCY_MIQUELON | L_TWCY_MIQUELON
TWCY_MONACO | L_TWCY_MONACO
TWCY_MONGOLIA | L_TWCY_MONGOLIA
TWCY_MONTSERRAT | L_TWCY_MONTSERRAT
TWCY_MOROCCO | L_TWCY_MOROCCO
TWCY_MOZAMBIQUE | L_TWCY_MOZAMBIQUE
TWCY_NAMIBIA | L_TWCY_NAMIBIA
TWCY_NAURU | L_TWCY_NAURU
TWCY_NEPAL | L_TWCY_NEPAL
TWCY_NETHERLANDS | L_TWCY_NETHERLANDS
TWCY_NETHANTILLES | L_TWCY_NETHANTILLES
TWCY_NEVIS | L_TWCY_NEVIS
TWCY_NEWCALEDONIA | L_TWCY_NEWCALEDONIA
TWCY_NEWZEALAND | L_TWCY_NEWZEALAND
TWCY_NICARAGUA | L_TWCY_NICARAGUA
TWCY_NIGER | L_TWCY_NIGER
TWCY_NIGERIA | L_TWCY_NIGERIA
TWCY_NIUE | L_TWCY_NIUE
TWCY_NORFOLKI | L_TWCY_NORFOLKI
TWCY_NORWAY | L_TWCY_NORWAY
TWCY_OMAN | L_TWCY_OMAN
TWCY_PAKISTAN | L_TWCY_PAKISTAN
TWCY_PALAU | L_TWCY_PALAU
TWCY_PANAMA | L_TWCY_PANAMA
TWCY_PARAGUAY | L_TWCY_PARAGUAY
TWCY_PERU | L_TWCY_PERU
TWCY_PHILLIPPINES | L_TWCY_PHILLIPPINES
TWCY_PITCAIRNIS | L_TWCY_PITCAIRNIS
TWCY_PNEWGUINEA | L_TWCY_PNEWGUINEA
TWCY_POLAND | L_TWCY_POLAND
TWCY_PORTUGAL | L_TWCY_PORTUGAL
TWCY_QATAR | L_TWCY_QATAR
TWCY_REUNIONI | L_TWCY_REUNIONI
TWCY_ROMANIA | L_TWCY_ROMANIA
TWCY_RWANDA | L_TWCY_RWANDA
TWCY_SAIPAN | L_TWCY_SAIPAN
TWCY_SANMARINO | L_TWCY_SANMARINO
TWCY_SAOTOME | L_TWCY_SAOTOME
TWCY_SAUDIARABIA | L_TWCY_SAUDIARABIA
TWCY_SENEGAL | L_TWCY_SENEGAL
TWCY_SEYCHELLESIS | L_TWCY_SEYCHELLESIS
TWCY_SIERRALEONE | L_TWCY_SIERRALEONE
TWCY_SINGAPORE | L_TWCY_SINGAPORE
TWCY_SOLOMONIS | L_TWCY_SOLOMONIS
TWCY_SOMALI | L_TWCY_SOMALI
TWCY_SOUTHAFRICA | L_TWCY_SOUTHAFRICA
TWCY_SPAIN | L_TWCY_SPAIN
TWCY_SRILANKA | L_TWCY_SRILANKA
TWCY_STHELENA | L_TWCY_STHELENA
TWCY_STKITTS | L_TWCY_STKITTS
TWCY_STLUCIA | L_TWCY_STLUCIA
TWCY_STPIERRE | L_TWCY_STPIERRE
TWCY_STVINCENT | L_TWCY_STVINCENT
TWCY_SUDAN | L_TWCY_SUDAN
TWCY_SURINAME | L_TWCY_SURINAME
TWCY_SWAZILAND | L_TWCY_SWAZILAND
TWCY_SWEDEN | L_TWCY_SWEDEN
TWCY_SWITZERLAND | L_TWCY_SWITZERLAND
TWCY_SYRIA | L_TWCY_SYRIA
TWCY_TAIWAN | L_TWCY_TAIWAN
TWCY_TANZANIA | L_TWCY_TANZANIA
TWCY_THAILAND | L_TWCY_THAILAND
TWCY_TOBAGO | L_TWCY_TOBAGO
TWCY_TOGO | L_TWCY_TOGO
TWCY_TONGAIS | L_TWCY_TONGAIS
TWCY_TRINIDAD | L_TWCY_TRINIDAD
TWCY_TUNISIA | L_TWCY_TUNISIA
TWCY_TURKEY | L_TWCY_TURKEY
TWCY_TURKSCAICOS | L_TWCY_TURKSCAICOS
TWCY_TUVALU | L_TWCY_TUVALU
TWCY_UGANDA | L_TWCY_UGANDA
TWCY_USSR | L_TWCY_USSR
TWCY_UAEMIRATES | L_TWCY_UAEMIRATES
TWCY_UNITEDKINGDOM | L_TWCY_UNITEDKINGDOM
TWCY_USA | L_TWCY_USA
TWCY_URUGUAY | L_TWCY_URUGUAY
TWCY_VANUATU | L_TWCY_VANUATU
TWCY_VATICANCITY | L_TWCY_VATICANCITY
TWCY_VENEZUELA | L_TWCY_VENEZUELA
TWCY_WAKE | L_TWCY_WAKE
TWCY_WALLISIS | L_TWCY_WALLISIS
TWCY_WESTERNSAHARA | L_TWCY_WESTERNSAHARA
TWCY_WESTERNSAMOA | L_TWCY_WESTERNSAMOA
TWCY_YEMEN | L_TWCY_YEMEN
TWCY_YUGOSLAVIA | L_TWCY_YUGOSLAVIA
TWCY_ZAIRE | L_TWCY_ZAIRE
TWCY_ZAMBIA | L_TWCY_ZAMBIA
TWCY_ZIMBABWE | L_TWCY_ZIMBABWE
TWCY_ALBANIA | L_TWCY_ALBANIA
TWCY_ARMENIA | L_TWCY_ARMENIA
TWCY_AZERBAIJAN | L_TWCY_AZERBAIJAN
TWCY_BELARUS | L_TWCY_BELARUS
TWCY_BOSNIAHERZGO | L_TWCY_BOSNIAHERZGO
TWCY_CAMBODIA | L_TWCY_CAMBODIA
TWCY_CROATIA | L_TWCY_CROATIA
TWCY_CZECHREPUBLIC | L_TWCY_CZECHREPUBLIC
TWCY_DIEGOGARCIA | L_TWCY_DIEGOGARCIA
TWCY_ERITREA | L_TWCY_ERITREA
TWCY_ESTONIA | L_TWCY_ESTONIA
TWCY_GEORGIA | L_TWCY_GEORGIA
TWCY_LATVIA | L_TWCY_LATVIA
TWCY_LESOTHO | L_TWCY_LESOTHO
TWCY_LITHUANIA | L_TWCY_LITHUANIA
TWCY_MACEDONIA | L_TWCY_MACEDONIA
TWCY_MAYOTTEIS | L_TWCY_MAYOTTEIS
TWCY_MOLDOVA | L_TWCY_MOLDOVA
TWCY_MYANMAR | L_TWCY_MYANMAR
TWCY_NORTHKOREA | L_TWCY_NORTHKOREA
TWCY_PUERTORICO | L_TWCY_PUERTORICO
TWCY_RUSSIA | L_TWCY_RUSSIA
TWCY_SERBIA | L_TWCY_SERBIA
TWCY_SLOVAKIA | L_TWCY_SLOVAKIA
TWCY_SLOVENIA | L_TWCY_SLOVENIA
TWCY_SOUTHKOREA | L_TWCY_SOUTHKOREA
TWCY_UKRAINE | L_TWCY_UKRAINE
TWCY_USVIRGINIS | L_TWCY_USVIRGINIS
TWCY_VIETNAM | L_TWCY_VIETNAM

Twain Language

TWLG_DAN | L_TWLG_DAN
TWLG_DUT | L_TWLG_DUT
TWLG_ENG | L_TWLG_ENG
TWLG_FCF | L_TWLG_FCF
TWLG_FIN | L_TWLG_FIN
TWLG_FRN | L_TWLG_FRN
TWLG_GER | L_TWLG_GER
TWLG_ICE | L_TWLG_ICE
TWLG_ITN | L_TWLG_ITN
TWLG_NOR | L_TWLG_NOR
TWLG_POR | L_TWLG_POR
TWLG_SPA | L_TWLG_SPA
TWLG_SWE | L_TWLG_SWE
TWLG_USA | L_TWLG_USA
TWLG_USERLOCALE | L_TWLG_USERLOCALE
TWLG_AFRIKAANS | L_TWLG_AFRIKAANS
TWLG_ALBANIA | L_TWLG_ALBANIA
TWLG_ARABIC | L_TWLG_ARABIC
TWLG_ARABIC_ALGERIA | L_TWLG_ARABIC_ALGERIA
TWLG_ARABIC_BAHRAIN | L_TWLG_ARABIC_BAHRAIN
TWLG_ARABIC_EGYPT | L_TWLG_ARABIC_EGYPT
TWLG_ARABIC_IRAQ | L_TWLG_ARABIC_IRAQ
TWLG_ARABIC_JORDAN | L_TWLG_ARABIC_JORDAN
TWLG_ARABIC_KUWAIT | L_TWLG_ARABIC_KUWAIT
TWLG_ARABIC_LEBANON | L_TWLG_ARABIC_LEBANON
TWLG_ARABIC_LIBYA | L_TWLG_ARABIC_LIBYA
TWLG_ARABIC_MOROCCO | L_TWLG_ARABIC_MOROCCO
TWLG_ARABIC_OMAN | L_TWLG_ARABIC_OMAN
TWLG_ARABIC_QATAR | L_TWLG_ARABIC_QATAR
TWLG_ARABIC_SAUDIARABIA | L_TWLG_ARABIC_SAUDIARABIA
TWLG_ARABIC_SYRIA | L_TWLG_ARABIC_SYRIA
TWLG_ARABIC_TUNISIA | L_TWLG_ARABIC_TUNISIA
TWLG_ARABIC_UAE | L_TWLG_ARABIC_UAE
TWLG_ARABIC_YEMEN | L_TWLG_ARABIC_YEMEN
TWLG_BASQUE | L_TWLG_BASQUE
TWLG_BYELORUSSIAN | L_TWLG_BYELORUSSIAN
TWLG_BULGARIAN | L_TWLG_BULGARIAN
TWLG_CATALAN | L_TWLG_CATALAN
TWLG_CHINESE | L_TWLG_CHINESE
TWLG_CHINESE_HONGKONG | L_TWLG_CHINESE_HONGKONG
TWLG_CHINESE_PRC | L_TWLG_CHINESE_PRC
TWLG_CHINESE_SINGAPORE | L_TWLG_CHINESE_SINGAPORE
TWLG_CHINESE_SIMPLIFIED | L_TWLG_CHINESE_SIMPLIFIED
TWLG_CHINESE_TAIWAN | L_TWLG_CHINESE_TAIWAN
TWLG_CHINESE_TRADITIONAL | L_TWLG_CHINESE_TRADITIONAL
TWLG_CROATIA | L_TWLG_CROATIA
TWLG_CZECH | L_TWLG_CZECH
TWLG_DANISH | L_TWLG_DANISH
TWLG_DUTCH | L_TWLG_DUTCH
TWLG_DUTCH_BELGIAN | L_TWLG_DUTCH_BELGIAN
TWLG_ENGLISH | L_TWLG_ENGLISH
TWLG_ENGLISH_AUSTRALIAN | L_TWLG_ENGLISH_AUSTRALIAN
TWLG_ENGLISH_CANADIAN | L_TWLG_ENGLISH_CANADIAN
TWLG_ENGLISH_IRELAND | L_TWLG_ENGLISH_IRELAND
TWLG_ENGLISH_NEWZEALAND | L_TWLG_ENGLISH_NEWZEALAND
TWLG_ENGLISH_SOUTHAFRICA | L_TWLG_ENGLISH_SOUTHAFRICA
TWLG_ENGLISH_UK | L_TWLG_ENGLISH_UK
TWLG_ENGLISH_USA | L_TWLG_ENGLISH_USA
TWLG_ESTONIAN | L_TWLG_ESTONIAN
TWLG_FAEROESE | L_TWLG_FAEROESE
TWLG_FARSI | L_TWLG_FARSI
TWLG_FINNISH | L_TWLG_FINNISH
TWLG_FRENCH | L_TWLG_FRENCH
TWLG_FRENCH_BELGIAN | L_TWLG_FRENCH_BELGIAN
TWLG_FRENCH_CANADIAN | L_TWLG_FRENCH_CANADIAN
TWLG_FRENCH_LUXEMBOURG | L_TWLG_FRENCH_LUXEMBOURG
TWLG_FRENCH_SWISS | L_TWLG_FRENCH_SWISS
TWLG_GERMAN | L_TWLG_GERMAN
TWLG_GERMAN_AUSTRIAN | L_TWLG_GERMAN_AUSTRIAN
TWLG_GERMAN_LUXEMBOURG | L_TWLG_GERMAN_LUXEMBOURG
TWLG_GERMAN_LIECHTENSTEIN | L_TWLG_GERMAN_LIECHTENSTEIN
TWLG_GERMAN_SWISS | L_TWLG_GERMAN_SWISS
TWLG_GREEK | L_TWLG_GREEK
TWLG_HEBREW | L_TWLG_HEBREW
TWLG_HUNGARIAN | L_TWLG_HUNGARIAN
TWLG_ICELANDIC | L_TWLG_ICELANDIC
TWLG_INDONESIAN | L_TWLG_INDONESIAN
TWLG_ITALIAN | L_TWLG_ITALIAN
TWLG_ITALIAN_SWISS | L_TWLG_ITALIAN_SWISS
TWLG_JAPANESE | L_TWLG_JAPANESE
TWLG_KOREAN | L_TWLG_KOREAN
TWLG_KOREAN_JOHAB | L_TWLG_KOREAN_JOHAB
TWLG_LATVIAN | L_TWLG_LATVIAN
TWLG_LITHUANIAN | L_TWLG_LITHUANIAN
TWLG_NORWEGIAN | L_TWLG_NORWEGIAN
TWLG_NORWEGIAN_BOKMAL | L_TWLG_NORWEGIAN_BOKMAL
TWLG_NORWEGIAN_NYNORSK | L_TWLG_NORWEGIAN_NYNORSK
TWLG_POLISH | L_TWLG_POLISH
TWLG_PORTUGUESE | L_TWLG_PORTUGUESE
TWLG_PORTUGUESE_BRAZIL | L_TWLG_PORTUGUESE_BRAZIL
TWLG_ROMANIAN | L_TWLG_ROMANIAN
TWLG_RUSSIAN | L_TWLG_RUSSIAN
TWLG_SERBIAN_LATIN | L_TWLG_SERBIAN_LATIN
TWLG_SLOVAK | L_TWLG_SLOVAK
TWLG_SLOVENIAN | L_TWLG_SLOVENIAN
TWLG_SPANISH | L_TWLG_SPANISH
TWLG_SPANISH_MEXICAN | L_TWLG_SPANISH_MEXICAN
TWLG_SPANISH_MODERN | L_TWLG_SPANISH_MODERN
TWLG_SWEDISH | L_TWLG_SWEDISH
TWLG_THAI | L_TWLG_THAI
TWLG_TURKISH | L_TWLG_TURKISH
TWLG_UKRANIAN | L_TWLG_UKRANIAN
TWLG_ASSAMESE | L_TWLG_ASSAMESE
TWLG_BENGALI | L_TWLG_BENGALI
TWLG_BIHARI | L_TWLG_BIHARI
TWLG_BODO | L_TWLG_BODO
TWLG_DOGRI | L_TWLG_DOGRI
TWLG_GUJARATI | L_TWLG_GUJARATI
TWLG_HARYANVI | L_TWLG_HARYANVI
TWLG_HINDI | L_TWLG_HINDI
TWLG_KANNADA | L_TWLG_KANNADA
TWLG_KASHMIRI | L_TWLG_KASHMIRI
TWLG_MALAYALAM | L_TWLG_MALAYALAM
TWLG_MARATHI | L_TWLG_MARATHI
TWLG_MARWARI | L_TWLG_MARWARI
TWLG_MEGHALAYAN | L_TWLG_MEGHALAYAN
TWLG_MIZO | L_TWLG_MIZO
TWLG_NAGA | L_TWLG_NAGA
TWLG_ORISSI | L_TWLG_ORISSI
TWLG_PUNJABI | L_TWLG_PUNJABI
TWLG_PUSHTU | L_TWLG_PUSHTU
TWLG_SERBIAN_CYRILLIC | L_TWLG_SERBIAN_CYRILLIC
TWLG_SIKKIMI | L_TWLG_SIKKIMI
TWLG_SWEDISH_FINLAND | L_TWLG_SWEDISH_FINLAND
TWLG_TAMIL | L_TWLG_TAMIL
TWLG_TELUGU | L_TWLG_TELUGU
TWLG_TRIPURI | L_TWLG_TRIPURI
TWLG_URDU | L_TWLG_URDU
TWLG_VIETNAMESE | L_TWLG_VIETNAMESE

Twain Capabilities

CAP_CUSTOMBASE | L_CAP_CUSTOMBASE
CAP_XFERCOUNT | L_CAP_XFERCOUNT
ICAP_COMPRESSION | L_ICAP_COMPRESSION
ICAP_PIXELTYPE | L_ICAP_PIXELTYPE
ICAP_UNITS | L_ICAP_UNITS
ICAP_XFERMECH | L_ICAP_XFERMECH
CAP_AUTHOR | L_CAP_AUTHOR
CAP_CAPTION | L_CAP_CAPTION
CAP_FEEDERENABLED | L_CAP_FEEDERENABLED
CAP_FEEDERLOADED | L_CAP_FEEDERLOADED
CAP_TIMEDATE | L_CAP_TIMEDATE
CAP_SUPPORTEDCAPS | L_CAP_SUPPORTEDCAPS
CAP_EXTENDEDCAPS | L_CAP_EXTENDEDCAPS
CAP_AUTOFEED | L_CAP_AUTOFEED
CAP_CLEARPAGE | L_CAP_CLEARPAGE
CAP_FEEDPAGE | L_CAP_FEEDPAGE
CAP_REWINDPAGE | L_CAP_REWINDPAGE
CAP_INDICATORS | L_CAP_INDICATORS
CAP_SUPPORTEDCAPSEXT | L_CAP_SUPPORTEDCAPSEXT
CAP_PAPERDETECTABLE | L_CAP_PAPERDETECTABLE
CAP_UICONTROLLABLE | L_CAP_UICONTROLLABLE
CAP_DEVICEONLINE | L_CAP_DEVICEONLINE
CAP_AUTOSCAN | L_CAP_AUTOSCAN
CAP_THUMBNAILSENABLED | L_CAP_THUMBNAILSENABLED
CAP_DUPLEX | L_CAP_DUPLEX
CAP_DUPLEXENABLED | L_CAP_DUPLEXENABLED
CAP_ENABLEDSUIONLY | L_CAP_ENABLEDSUIONLY
CAP_CUSTOMDSDATA | L_CAP_CUSTOMDSDATA
CAP_ENDORSER | L_CAP_ENDORSER
CAP_JOBCONTROL | L_CAP_JOBCONTROL
CAP_ALARMS | L_CAP_ALARMS
CAP_ALARMVOLUME | L_CAP_ALARMVOLUME
CAP_AUTOMATICCAPTURE | L_CAP_AUTOMATICCAPTURE
CAP_TIMEBEFOREFIRSTCAPTURE | L_CAP_TIMEBEFOREFIRSTCAPTURE
CAP_TIMEBETWEENCAPTURES | L_CAP_TIMEBETWEENCAPTURES
CAP_CLEARBUFFERS | L_CAP_CLEARBUFFERS
CAP_MAXBATCHBUFFERS | L_CAP_MAXBATCHBUFFERS
CAP_DEVICETIMEDATE | L_CAP_DEVICETIMEDATE
CAP_POWERSUPPLY | L_CAP_POWERSUPPLY
CAP_CAMERAPREVIEWUI | L_CAP_CAMERAPREVIEWUI
CAP_DEVICEEVENT | L_CAP_DEVICEEVENT
CAP_SERIALNUMBER | L_CAP_SERIALNUMBER
CAP_PRINTER | L_CAP_PRINTER
CAP_PRINTERENABLED | L_CAP_PRINTERENABLED
CAP_PRINTERINDEX | L_CAP_PRINTERINDEX
CAP_PRINTERMODE | L_CAP_PRINTERMODE
CAP_PRINTERSTRING | L_CAP_PRINTERSTRING
CAP_PRINTERSUFFIX | L_CAP_PRINTERSUFFIX
CAP_LANGUAGE | L_CAP_LANGUAGE
CAP_FEEDERALIGNMENT | L_CAP_FEEDERALIGNMENT
CAP_FEEDERORDER | L_CAP_FEEDERORDER
CAP_REACQUIREALLOWED | L_CAP_REACQUIREALLOWED
CAP_BATTERYMINUTES | L_CAP_BATTERYMINUTES
CAP_BATTERYPERCENTAGE | L_CAP_BATTERYPERCENTAGE
ICAP_AUTOBRIGHT | L_ICAP_AUTOBRIGHT
ICAP_BRIGHTNESS | L_ICAP_BRIGHTNESS
ICAP_CONTRAST | L_ICAP_CONTRAST
ICAP_CUSTHALFTONE | L_ICAP_CUSTHALFTONE
ICAP_EXPOSURETIME | L_ICAP_EXPOSURETIME
ICAP_FILTER | L_ICAP_FILTER
ICAP_FLASHUSED | L_ICAP_FLASHUSED
ICAP_GAMMA | L_ICAP_GAMMA
ICAP_HALFTONES | L_ICAP_HALFTONES
ICAP_HIGHLIGHT | L_ICAP_HIGHLIGHT
ICAP_IMAGEFILEFORMAT | L_ICAP_IMAGEFILEFORMAT
ICAP_LAMPSTATE | L_ICAP_LAMPSTATE
ICAP_LIGHTSOURCE | L_ICAP_LIGHTSOURCE
ICAP_ORIENTATION | L_ICAP_ORIENTATION
ICAP_PHYSICALWIDTH | L_ICAP_PHYSICALWIDTH
ICAP_PHYSICALHEIGHT | L_ICAP_PHYSICALHEIGHT
ICAP_SHADOW | L_ICAP_SHADOW
ICAP_FRAMES | L_ICAP_FRAMES
ICAP_XNATIVERESOLUTION | L_ICAP_XNATIVERESOLUTION
ICAP_YNATIVERESOLUTION | L_ICAP_YNATIVERESOLUTION
ICAP_XRESOLUTION | L_ICAP_XRESOLUTION
ICAP_YRESOLUTION | L_ICAP_YRESOLUTION
ICAP_MAXFRAMES | L_ICAP_MAXFRAMES
ICAP_TILES | L_ICAP_TILES
ICAP_BITORDER | L_ICAP_BITORDER
ICAP_CCITTKFACTOR | L_ICAP_CCITTKFACTOR
ICAP_LIGHTPATH | L_ICAP_LIGHTPATH
ICAP_PIXELFLAVOR | L_ICAP_PIXELFLAVOR
ICAP_PLANARCHUNKY | L_ICAP_PLANARCHUNKY
ICAP_ROTATION | L_ICAP_ROTATION
ICAP_SUPPORTEDSIZES | L_ICAP_SUPPORTEDSIZES
ICAP_THRESHOLD | L_ICAP_THRESHOLD
ICAP_XSCALING | L_ICAP_XSCALING
ICAP_YSCALING | L_ICAP_YSCALING
ICAP_BITORDERCODES | L_ICAP_BITORDERCODES
ICAP_PIXELFLAVORCODES | L_ICAP_PIXELFLAVORCODES
ICAP_JPEGPIXELTYPE | L_ICAP_JPEGPIXELTYPE
ICAP_TIMEFILL | L_ICAP_TIMEFILL
ICAP_BITDEPTH | L_ICAP_BITDEPTH
ICAP_BITDEPTHREDUCTION | L_ICAP_BITDEPTHREDUCTION
ICAP_UNDEFINEDIMAGESIZE | L_ICAP_UNDEFINEDIMAGESIZE
ICAP_IMAGEDATASET | L_ICAP_IMAGEDATASET
ICAP_EXTIMAGEINFO | L_ICAP_EXTIMAGEINFO
ICAP_MINIMUMHEIGHT | L_ICAP_MINIMUMHEIGHT
ICAP_MINIMUMWIDTH | L_ICAP_MINIMUMWIDTH
ICAP_FLIPROTATION | L_ICAP_FLIPROTATION
ICAP_BARCODEDETECTIONENABLED | L_ICAP_BARCODEDETECTIONENABLED
ICAP_SUPPORTEDBARCODETYPES | L_ICAP_SUPPORTEDBARCODETYPES
ICAP_BARCODEMAXSEARCHPRIORITIES | L_ICAP_BARCODEMAXSEARCHPRIORITIES
ICAP_BARCODESEARCHPRIORITIES | L_ICAP_BARCODESEARCHPRIORITIES
ICAP_BARCODESEARCHMODE | L_ICAP_BARCODESEARCHMODE
ICAP_BARCODEMAXRETRIES | L_ICAP_BARCODEMAXRETRIES
ICAP_BARCODETIMEOUT | L_ICAP_BARCODETIMEOUT
ICAP_ZOOMFACTOR | L_ICAP_ZOOMFACTOR
ICAP_PATCHCODEDETECTIONENABLED | L_ICAP_PATCHCODEDETECTIONENABLED
ICAP_SUPPORTEDPATCHCODETYPES | L_ICAP_SUPPORTEDPATCHCODETYPES
ICAP_PATCHCODEMAXSEARCHPRIORITIES | L_ICAP_PATCHCODEMAXSEARCHPRIORITIES
ICAP_PATCHCODESEARCHPRIORITIES | L_ICAP_PATCHCODESEARCHPRIORITIES
ICAP_PATCHCODESEARCHMODE | L_ICAP_PATCHCODESEARCHMODE
ICAP_PATCHCODEMAXRETRIES | L_ICAP_PATCHCODEMAXRETRIES
ICAP_PATCHCODETIMEOUT | L_ICAP_PATCHCODETIMEOUT
ICAP_FLASHUSED2 | L_ICAP_FLASHUSED2
ICAP_IMAGEFILTER | L_ICAP_IMAGEFILTER
ICAP_NOISEFILTER | L_ICAP_NOISEFILTER
ICAP_OVERSCAN | L_ICAP_OVERSCAN
ICAP_AUTOMATICBORDERDETECTION | L_ICAP_AUTOMATICBORDERDETECTION
ICAP_AUTOMATICDESKEW | L_ICAP_AUTOMATICDESKEW
ICAP_AUTOMATICROTATE | L_ICAP_AUTOMATICROTATE
ICAP_JPEGQUALITY | L_ICAP_JPEGQUALITY
ACAP_AUDIOFILEFORMAT | L_ACAP_AUDIOFILEFORMAT
ACAP_XFERMECH | L_ACAP_XFERMECH

Twain Extended Image

TWEI_BARCODEX | L_TWEI_BARCODEX
TWEI_BARCODEY | L_TWEI_BARCODEY
TWEI_BARCODETEXT | L_TWEI_BARCODETEXT
TWEI_BARCODETYPE | L_TWEI_BARCODETYPE
TWEI_DESHADETOP | L_TWEI_DESHADETOP
TWEI_DESHADELEFT | L_TWEI_DESHADELEFT
TWEI_DESHADEHEIGHT | L_TWEI_DESHADEHEIGHT
TWEI_DESHADEWIDTH | L_TWEI_DESHADEWIDTH
TWEI_DESHADESIZE | L_TWEI_DESHADESIZE
TWEI_SPECKLESREMOVED | L_TWEI_SPECKLESREMOVED
TWEI_HORZLINEXCOORD | L_TWEI_HORZLINEXCOORD
TWEI_HORZLINEYCOORD | L_TWEI_HORZLINEYCOORD
TWEI_HORZLINELENGTH | L_TWEI_HORZLINELENGTH
TWEI_HORZLINETHICKNESS | L_TWEI_HORZLINETHICKNESS
TWEI_VERTLINEXCOORD | L_TWEI_VERTLINEXCOORD
TWEI_VERTLINEYCOORD | L_TWEI_VERTLINEYCOORD
TWEI_VERTLINELENGTH | L_TWEI_VERTLINELENGTH
TWEI_VERTLINETHICKNESS | L_TWEI_VERTLINETHICKNESS
TWEI_PATCHCODE | L_TWEI_PATCHCODE
TWEI_ENDORSEDTEXT | L_TWEI_ENDORSEDTEXT
TWEI_FORMCONFIDENCE | L_TWEI_FORMCONFIDENCE
TWEI_FORMTEMPLATEMATCH | L_TWEI_FORMTEMPLATEMATCH
TWEI_FORMTEMPLATEPAGEMATCH | L_TWEI_FORMTEMPLATEPAGEMATCH
TWEI_FORMHORZDOCOFFSET | L_TWEI_FORMHORZDOCOFFSET
TWEI_FORMVERTDOCOFFSET | L_TWEI_FORMVERTDOCOFFSET
TWEI_BARCODECOUNT | L_TWEI_BARCODECOUNT
TWEI_BARCODECONFIDENCE | L_TWEI_BARCODECONFIDENCE
TWEI_BARCODEROTATION | L_TWEI_BARCODEROTATION
TWEI_BARCODETEXTLENGTH | L_TWEI_BARCODETEXTLENGTH
TWEI_DESHADECOUNT | L_TWEI_DESHADECOUNT
TWEI_DESHADEBLACKCOUNTOLD | L_TWEI_DESHADEBLACKCOUNTOLD
TWEI_DESHADEBLACKCOUNTNEW | L_TWEI_DESHADEBLACKCOUNTNEW
TWEI_DESHADEBLACKRLMIN | L_TWEI_DESHADEBLACKRLMIN
TWEI_DESHADEBLACKRLMAX | L_TWEI_DESHADEBLACKRLMAX
TWEI_DESHADEWHITECOUNTOLD | L_TWEI_DESHADEWHITECOUNTOLD
TWEI_DESHADEWHITECOUNTNEW | L_TWEI_DESHADEWHITECOUNTNEW
TWEI_DESHADEWHITERLMIN | L_TWEI_DESHADEWHITERLMIN
TWEI_DESHADEWHITERLAVE | L_TWEI_DESHADEWHITERLAVE
TWEI_DESHADEWHITERLMAX | L_TWEI_DESHADEWHITERLMAX
TWEI_BLACKSPECKLESREMOVED | L_TWEI_BLACKSPECKLESREMOVED
TWEI_WHITESPECKLESREMOVED | L_TWEI_WHITESPECKLESREMOVED
TWEI_HORZLINECOUNT | L_TWEI_HORZLINECOUNT
TWEI_VERTLINECOUNT | L_TWEI_VERTLINECOUNT
TWEI_DESKEWSTATUS | L_TWEI_DESKEWSTATUS
TWEI_SKEWORIGINALANGLE | L_TWEI_SKEWORIGINALANGLE
TWEI_SKEWFINALANGLE | L_TWEI_SKEWFINALANGLE
TWEI_SKEWCONFIDENCE | L_TWEI_SKEWCONFIDENCE
TWEI_SKEWWINDOWX1 | L_TWEI_SKEWWINDOWX1
TWEI_SKEWWINDOWY1 | L_TWEI_SKEWWINDOWY1
TWEI_SKEWWINDOWX2 | L_TWEI_SKEWWINDOWX2
TWEI_SKEWWINDOWY2 | L_TWEI_SKEWWINDOWY2
TWEI_SKEWWINDOWX3 | L_TWEI_SKEWWINDOWX3
TWEI_SKEWWINDOWY3 | L_TWEI_SKEWWINDOWY3
TWEI_SKEWWINDOWX4 | L_TWEI_SKEWWINDOWX4
TWEI_SKEWWINDOWY4 | L_TWEI_SKEWWINDOWY4
TWEI_BOOKNAME | L_TWEI_BOOKNAME
TWEI_CHAPTERNUMBER | L_TWEI_CHAPTERNUMBER
TWEI_DOCUMENTNUMBER | L_TWEI_DOCUMENTNUMBER
TWEI_PAGENUMBER | L_TWEI_PAGENUMBER
TWEI_CAMERA | L_TWEI_CAMERA
TWEI_FRAMENUMBER | L_TWEI_FRAMENUMBER
TWEI_FRAME | L_TWEI_FRAME
TWEI_PIXELFLAVOR | L_TWEI_PIXELFLAVOR
TWEJ_NONE | L_TWEJ_NONE
TWEJ_MIDSEPARATOR | L_TWEJ_MIDSEPARATOR
TWEJ_PATCH1 | L_TWEJ_PATCH1
TWEJ_PATCH2 | L_TWEJ_PATCH2
TWEJ_PATCH3 | L_TWEJ_PATCH3
TWEJ_PATCH4 | L_TWEJ_PATCH4
TWEJ_PATCH6 | L_TWEJ_PATCH6
TWEJ_PATCHT | L_TWEJ_PATCHT

Twain Pass Thru

TWDR_GET | L_TWDR_GET
TWDR_SET | L_TWDR_SET


A Special Note About UNICODE Support

LEADTOOLS now provides UNICODE support. However, in order to utilize the examples and tutorials in this help file with UNICODE, you must make a few substitutions for class names, IDs, event names, etc. This is true for VB, MFC, Delphi and C++ Builder. Before attempting to compile the samples or tutorials in this help file for UNICODE, replace the class name, ID name, event name, etc. in the first column below, with the corresponding name in the second column. As you can see, this just involves adding "_U" to the end of the class name, ID name, event name, etc.

General Notes For VC++ Programmers:

1.

Replace: | With:
LTRASTERXXXXLib | LTRASTERXXXXLib_U
ILEADRasterXXXX | ILEADRasterXXXX_U
LEADRasterXXXX | LEADRasterXXXX_U
IID_ILEADRasterXXXX | IID_ILEADRasterXXXX_U
CLSID_LEADRasterXXXX | CLSID_LEADRasterXXXX_U
LIBID_LTRASTERXXXXLib | LIBID_LTRASTERXXXXLib_U
_LEADRasterXXXXEvents | _LEADRasterXXXXEvents_U
DIID__LEADRasterXXXXEvents | DIID__LEADRasterXXXXEvents_U

For example:

ILEADRasterIO_U *pRasterIO=NULL;

CoCreateInstance(CLSID_LEADRasterIO_U, NULL, CLSCTX_ALL, IID_ILEADRasterIO_U, (void**)&pRasterIO);

2.

For importing (.DLL) or (.OCX) files in your project:

Replace: | With:
LTRXXXN.OCX | LTRXXXNU.OCX
LTRXXXN.DLL | LTRXXXNU.DLL

For example:

#import "c:\\winnt\\system32\\ltrvr14nu.dll" no_namespace, named_guids

#import "c:\\winnt\\system32\\ltrvw14nu.ocx" no_namespace, named_guids

General Notes For VB Programmers:

Replace: | With:
LTRASTERXXXXLib | LTRASTERXXXXLib_U
LEADRasterXXXX | LEADRasterXXXX_U
LEADRasterXXXX_EventName | LEADRasterXXXX_U_EventName
LEADRasterXXXX.LEADRasterXXXX | LEADRasterXXXX_U.LEADRasterXXXX_U

When adding a Reference or Component to a Visual Basic project, be sure that the desired Reference or Component name ends with (_U).

For example:

To add the Unicode version of LEAD RasterView Control to your project, you have to select LEAD Raster View_U Control (14).

General Notes For Delphi and C++ Builder Programmers:

Replace: | With:
LTRASTERXXXLib_TLB | LTRASTERXXXLib_U_TLB
ILEADRasterXXXX | ILEADRasterXXXX_U
CLASS_LEADRasterXXXX | CLASS_LEADRasterXXXX_U
LEADRasterXXXX | LEADRasterXXXX_U
IID_ILEADRasterXXXX | IID_ILEADRasterXXXX_U
CLSID_LEADRasterXXXX | CLSID_LEADRasterXXXX_U
LIBID_LTRASTERXXXXLib | LIBID_LTRASTERXXXXLib_U
_LEADRasterXXXXEvents | _LEADRasterXXXXEvents_U
DIID__LEADRasterXXXXEvents | DIID__LEADRasterXXXXEvents_U

Note:

When adding an ActiveX Control or Import type library to a Delphi or C++ Builder project, be sure that the desired ActiveX Control or Library name ends with (_U).

For example:

To add the Unicode version of LEAD Raster View Control to your project, you have to select LEAD Raster View_U Control (14).


Tutorial for Visual Basic Programmers

The following topics provide brief and simple examples to help you learn how to use the LEAD sRasterTwain Object Library.

For general information about the syntax requirements of this interface, refer to Visual Basic Syntax .

LEADTOOLS Twain COM supports UNICODE. For more information on using the samples in this help file with UNICODE, please refer to A Special Note About UNICODE Support.

Note:

These tutorial examples are intended to be easy to understand and easy to test. The example programs in the EXAMPLES subdirectory provide more in depth design and more detailed code.

Acquiring an Image

Using the Fast TWAIN Feature

Get a Fast Twain Scan from a Scanner

Set/Get a Twain Capability

Twain Duplex (Visual Basic)

Twain Feeder : Tutorial #1 (Visual Basic)

Twain Feeder: Tutorial #2 (Visual Basic)

Miscellaneous Examples


Acquiring an Image (Visual Basic)

Take the following steps to start a project and to add some code that acquires an image from a TWAIN source:

1. | Start Visual Basic.
2. | Add the LEAD RasterView Control to your project. On the Project pull-down menu, use the Components option, and select the LEAD Raster View Control (14).
3. | Add the LEAD RasterTwain Object Library and LEAD Raster Variant Object Library to your project.
 | On the Project pull-down menu, use the References option, and select the LEAD RasterTwain Object Library (14).
 | On the Project pull-down menu, use the References option, and select the LEAD Raster Variant Object Library (14).
4. | Add the following code to the general declarations section of your project:

Public TwainCap As New LEADTwainCapability
Public WithEvents RasterTwain As LEADRasterTwain
Public nXferMode As Integer
Public nRet As Integer

5.

Add the following code to the main form's Load procedure:

Set RasterTwain = New LEADRasterTwain
RasterTwain.InitSession hWnd

6.

Add the following code to the main form's Unload procedure:

RasterTwain.EndSession

7. | At the top of your main form, add six Command Buttons and three Option Buttons and name them as follows:
 | Name | Caption
 | OK | OK
 | Cancel | Cancel
 | Acquire | Acquire
 | SelectSource | SelectSource
 | CmdSaveTemplate | Save Template File
 | Native | Native
 | MemBuf | Memory Buffered
 | File | File
 | CmdLoadTemplate | Load Template File
8. | Code the OK control's Click procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub OK_Click()
Unload Me
End Sub

9.

Code the Cancel control's Click procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code:

Private Sub Cancel_Click()
Unload Me
End Sub

10.

Code the Acquire control's Click procedure as follows:

Private Sub Acquire_Click()
RasterTwain.Acquire L_LTWAIN_SHOW_USER_INTERFACE
End Sub

11.

Code the SelectSource control's Click procedure as follows:

Private Sub SelectSource_Click()
RasterTwain.SelectSource
End Sub

12.

Code the CmdSaveTemplate control's Click procedure as follows:

Private Sub cmdSaveTemplate_Click()
nRet = RasterTwain.SaveTemplate("c:\test.ltt")
End Sub

13.

Code the cmdLoadTemplate control's Click procedure as follows:

Private Sub cmdLoadTemplate_Click()
nRet = RasterTwain.LoadTemplate("c:\test.ltt")
End Sub

14.

Code the Native option control's Click procedure as Follows:

Private Sub Native_Click()
Dim CapVal As LEADRasterVariant
nXferMode = L_TWSX_NATIVE

CapVal.Type = VALUE_USHORT
CapVal.LongValue = nXferMode
TwainSetCapability L_ICAP_XFERMECH, CapVal, L_TWTY_UINT16
End Sub

15.

Code the MemBuf Option control's Click procedure as follows:

Private Sub MemBuf_Click()
Dim CapVal As LEADRasterVariant
nXferMode = L_TWSX_MEMORY
CapVal.Type = VALUE_USHORT
CapVal.LongValue = nXferMode
TwainSetCapability L_ICAP_XFERMECH, CapVal, L_TWTY_UINT16
End Sub

16.

Code the File Option control's Click procedure as follows:

Private Sub File_Click()
Dim CapVal As LEADRasterVariant
nXferMode = L_TWSX_FILE
CapVal.Type = VALUE_USHORT
CapVal.LongValue = nXferMode
TwainSetCapability L_ICAP_XFERMECH, CapVal, L_TWTY_UINT16
RasterTwain.FileTransferName = "c:\twain.bmp"
End Sub

17.

Code RasterTwain object’s procedure as follows:

Private Sub RasterTwain_AcquirePageEvent(ByVal pBitmap As Long)
MsgBox "Acquisition of Image Done"
LEADRasterView1.Raster.InsertBitmapListItem -1, pBitmap
End Sub

18.

Add this Function to the Project:

Public Function TwainSetCapability(uCapability As Integer, CapVal As LEADRasterVariant, uItemType As Integer) As Integer
Dim iRet As Integer

TwainCap.EnableMethodErrors = False
TwainCap.CapInfo.Capability = uCapability
TwainCap.CapInfo.ConType = L_TWON_ONEVALUE
TwainCap.CapOneValue.OneValItemType = uItemType
TwainCap.CapOneValue.OneValCapValue = CapVal

iRet = RasterTwain.SetCapability2(TwainCap, L_LTWAIN_CAPABILITY_SET)
TwainSetCapability = iRet
End Function

19.

Run your program to test it.


Using the Fast TWAIN Feature (Visual Basic)

Take the following steps to start a project and to add some code that acquires the images using Fast Twain:

1. | Start Visual Basic.
2. | Add the LEAD RasterTwain Object Library and LEAD Raster Variant Object Library to your project.
 | On the Project pull-down menu, use the References option, and select the LEAD RasterTwain Object Library (14).
 | On the Project pull-down menu, use the References option, and select the LEAD Raster Variant Object Library (14).
3. | Add the LEAD Raster IO Object Library to your project. On the Project pull-down menu, use the References option, and select the LEAD Raster IO Object Library (14).
4. | Add the following code to the general declarations section of your project:

Public TwainCap As New LEADTwainCapability
Public WithEvents RasterTwain As LEADRasterTwain
Public nXferMode As Integer
Public nRet As Integer
Public RasterIO As LEADRasterIO

5.

Add the following code to the main form's Load procedure:

Set RasterTwain = New LEADRasterTwain
RasterTwain.InitSession hWnd
RasterTwain.EnableMethodErrors = False
optMemory.Value = True

6.

Add the following code to the main form's Unload procedure:

RasterTwain.EndSession

7. | At the top of your main form, add 1 check box
 | Name | Caption
 | chkUseBufferSize | Use Buffer Size
8. | Add the following radio buttons:
 | Name | Caption
 | optNative | Native Mode
 | optMemory | Memory Mode
9. | Add the following button:
 | Name | Caption
 | cmdAcquire | Fast Acquire
10. | Add the two text boxes and name them as follows:

txtBufferSize

txtFName

11.

Code the Fast Acquire control's Click procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

If optMemory.Value = True Then
RasterTwain.FastTransferMode = L_LTWAIN_BUFFER_MODE
RasterTwain.FastFormat = FILE_CCITT_GROUP4
Else
RasterTwain.FastTransferMode = L_LTWAIN_NATIVE_MODE
RasterTwain.FastFormat = FILE_TIF
End If

RasterTwain.FastBitsPerPixel = 1
RasterTwain.FastUsePreferredBufferSize = chkUseBufferSize.Value
RasterTwain.FastBufferSize = Val(txtBufferSize.Text)

nRet = RasterTwain.AcquireMulti(txtFName.Text, L_LTWAIN_SHOW_USER_INTERFACE Or L_LTWAIN_USE_THREAD_MODE, True)
If nRet = 0 Then
MsgBox "Fast Scanning process completed successfully..."
Else
MsgBox "The AcquireMulti method failed, Error = " + Str(nRet)
End If

12.

Save your project and run your program to test it.


Get a Fast Twain Scan from a Scanner (Visual Basic)

Take the following steps to start a project and to add some code to find the fastest configuration for your scanner using the LEADTOOLS Fast TWAIN feature:

1. | Start Visual Basic.
2. | Add the LEAD RasterTwain Object Library and LEAD Raster Variant Object Library to your project.
 | On the Project pull-down menu, use the References option, and select the LEAD RasterTwain Object Library (14).
 | On the Project pull-down menu, use the References option, and select the LEAD Raster Variant Object Library (14).
3. | Add the LEAD Raster Object Library to your project. On the Project pull-down menu, use the References option, and select the LEAD Raster Object Library (14).
4. | Add the following code to the general declarations section of your project:

Public TwainCap As New LEADTwainCapability
Public WithEvents RasterTwain As LEADRasterTwain
Public nXferMode As Integer
Public nRet As Integer

5.

Add the following code to the main form's Load procedure:

Set RasterTwain = New LEADRasterTwain
RasterTwain.InitSession hWnd
RasterTwain.EnableMethodErrors = False

' Unlock Document support.
' Note that this is a sample key, which will not work in your toolkit.
RasterTwain.UnlockSupport L_SUPPORT_DOCUMENT, "TestKey"

6.

Add the following code to the main form's Unload procedure:

RasterTwain.EndSession
Set RasterTwain = Nothing

7. | At the top of your main form, add 3 command buttons as following:
 | Name | Caption
 | cmdSelectSource | Select Source
 | cmdFindFastConfig | Find Fast Config
 | cmdAcquireFastConfig | Acquire Fast Config
8. | Code the "Select Source" control's Click procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub cmdSelectSource_Click()
RasterTwain.SelectSource
End Sub

9.

Code the "Find Fast Config" control's Click procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub cmdFindFastConfig_Click()
RasterTwain.UserFastConfigsCount = 0
RasterTwain.EnableFastConfigEvent = False
nRet = RasterTwain.FindFastConfig ("c:\temp", L_LTWAIN_SHOW_USER_INTERFACE Or L_LTWAIN_USE_THREAD_MODE, 8, 5)

If nRet = 0 Then
MsgBox "Find Fast Configuration process completed."
Else
MsgBox "An error occurred during the Finding Fast Configuration process."
End If
End Sub

10.

Code the "Acquire Fast Config" control's Click procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub cmdAcquireFastConfig_Click()
RasterTwain.FastTransferMode = RasterTwain.BestFastConfig.TransferMode
RasterTwain.FastFormat = RasterTwain.BestFastConfig.FileFormat
RasterTwain.FastBitsPerPixel = RasterTwain.BestFastConfig.BitsPerPixel
RasterTwain.FastBufferSize = RasterTwain.BestFastConfig.BufferSize

RasterTwain.FastUsePreferredBufferSize = True
RasterTwain.EnableAcquireMultiEvent = False

nRet = RasterTwain.AcquireMulti ("c:\temp\test", L_LTWAIN_SHOW_USER_INTERFACE, True)

If nRet = 0 Then
MsgBox "Image acquisition using the Fast TWAIN Configuration is completed."
Else
MsgBox "An error occurred while acquiring images using the Fast TWAIN Configuration."
End If
End Sub

11.

Save your project and run your program to test it.


Set/Get a Twain Capability (Visual Basic)

Take the following steps to start a project and to add some code to use the Get/Set capability methods and then acquire your image using the newly set capability:

1. | Start Visual Basic.
2. | Add the LEAD RasterTwain Object Library and LEAD Raster Variant Object Library to your project.
 | On the Project pull-down menu, use the References option, and select the LEAD RasterTwain Object Library (14).
 | On the Project pull-down menu, use the References option, and select the LEAD Raster Variant Object Library (14).
3. | Add the LEAD Raster Object Library to your project. On the Project pull-down menu, use the References option, and select the LEAD Raster Object Library (14).
4. | Add the following code to the general declarations section of your project:

Public TwnGetCap As New LEADTwainCapability
Public TwnSetCap As New LEADTwainCapability
Public WithEvents RasterTwain As LEADRasterTwain
Public nXferMode As Integer
Public nRet As Integer

5.

Add the following code to the main form's Load procedure:

Set RasterTwain = New LEADRasterTwain
RasterTwain.InitSession hWnd
RasterTwain.EnableMethodErrors = False

' Unlock Document support.
' Note that this is a sample key, which will not work in your toolkit.
RasterTwain.UnlockSupport L_SUPPORT_DOCUMENT, "TestKey"

6.

Add the following code to the main form's Unload procedure:

RasterTwain.EndSession
Set RasterTwain = Nothing

7. | At the top of your main form, add 4 command buttons and name them as follows:
 | Name | Caption
 | cmdSelectSource | Select Source
 | cmdUseCapability | Use Capability
 | cmdSetBrightness | Set Brightness
 | cmdAcquire | Acquire
8. | Code the "Select Source" control's Click procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub cmdSelectSource_Click()
RasterTwain.SelectSource
End Sub

9.

Code the "Use Capability" control's Click procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub cmdUseCapability_Click()
Dim Xfer As New LEADRasterVariant

TwnGetCap.EnableMethodErrors = False
TwnGetCap.CapInfo.ConType = L_TWON_ONEVALUE
TwnGetCap.CapInfo.Capability = L_ICAP_XFERMECH

nRet = RasterTwain.GetCapability2 (TwnGetCap, L_LTWAIN_CAPABILITY_GETCURRENT)
If nRet = 0 Then
Xfer = TwnGetCap.CapOneValue.OneValCapValue
If Xfer.LongValue <> L_TWSX_FILE Then
TwnSetCap.EnableMethodErrors = False
TwnSetCap.CapInfo.Capability= L_ICAP_XFERMECH
TwnSetCap.CapInfo.ConType = L_TWON_ONEVALUE

Xfer.Type = VALUE_USHORT
Xfer.LongValue = L_TWSX_FILE
TwnSetCap.CapOneValue.OneValItemType = L_TWTY_UINT16
TwnSetCap.CapOneValue.OneValCapValue= Xfer

nRet = RasterTwain.SetCapability2 (TwnSetCap, L_LTWAIN_CAPABILITY_SET)
Else
MsgBox "The Transfer mode is File"
End If
Else
MsgBox "Error occurred in the GetCapability method"
End If
End Sub

10.

Code the "Set Brightness" control's Click procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub cmdSetBrightness_Click()
Dim iRet As Integer
Dim CapVal As New LEADRasterVariant
Dim TwainCap As New LEADTwainCapability

TwainCap.CapInfo.ConType = L_TWON_ONEVALUE
TwainCap.CapInfo.Capability = L_ICAP_BRIGHTNESS
TwainCap.EnableMethodErrors = False
CapVal.Type = VALUE_FLOAT
CapVal.FloatValue = 50#
TwainCap.CapOneValue.OneValItemType = L_TWTY_FIX32
TwainCap.CapOneValue.OneValCapValue = CapVal
iRet = RasterTwain.SetCapability2 (TwainCap, L_LTWAIN_CAPABILITY_SET)
If (iRet <> 0) Then
MsgBox "Error Setting Capability"
End If
Set TwainCap = Nothing
End Sub

11.

Code the "Acquire" control's Click procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub cmdAcquire_Click()
RasterTwain.FileTransferName = "c:\twain.bmp"
nRet = RasterTwain.Acquire (L_LTWAIN_SHOW_USER_INTERFACE)
If nRet <> 0 Then
MsgBox "Error acquiring from source"
End If
End Sub

12.

Save your project and run your program to test it.


Twain Duplex (Visual Basic)

Take the following steps to start a project and to add some code that acquires the images using Fast Twain:

1. | Start Visual Basic.
2. | Add the LEAD RasterTwain Object Library and LEAD Raster Variant Object Library to your project.
 | On the Project pull-down menu, use the References option, and select the LEAD RasterTwain Object Library (14).
 | On the Project pull-down menu, use the References option, and select the LEAD Raster Variant Object Library (14).
3. | Add the LEAD Raster IO Object Library to your project. On the Project pull-down menu, use the References option, and select the LEAD Raster IO Object Library (14).
4. | Add the following code to the general declarations section of your project:

Public TwainCap As New LEADTwainCapability
Public WithEvents RasterTwain As LEADRasterTwain

5.

Add the following code to the main form's Load procedure:

Set RasterTwain = New LEADRasterTwain
RasterTwain.InitSession hWnd
RasterTwain.EnableMethodErrors = False

6.

Add the following code to the main form's Unload procedure:

RasterTwain.EndSession

7. | Add the following button:
 | Name | Caption
 | cmdAcquire | Acquire
8. | Code the Acquire control's Click procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub cmdAcquire_Click()
Dim nRet As Integer
RasterTwain.SelectSource

TwainCap.CapInfo.Capability = L_CAP_DUPLEX
TwainCap.CapInfo.ConType = L_TWON_ONEVALUE

nRet = RasterTwain.GetCapability2(TwainCap, L_LTWAIN_CAPABILITY_GETVALUES)
If nRet = 0 Then
' check if the selected driver supports duplex capability
If TwainCap.CapOneValue.OneValItemType <> L_TWTY_UINT16 Then
RasterTwain.EndSession
Exit Sub
End If

Dim item As Integer
item = TwainCap.CapOneValue.OneValCapValue.LongValue

Select Case item
Case L_TWDX_NONE
MsgBox "Duplex capability is not supported in the selected driver"
Case L_TWDX_1PASSDUPLEX
MsgBox "1 Pass Duplex capability is supported in the selected driver"
Case L_TWDX_2PASSDUPLEX
MsgBox "2 Pass Duplex capability is supported in the selected driver"
End Select

' make sure the duplex capability is enabled
If item <> L_TWDX_NONE Then
Dim bEnable As Boolean
bEnable = True

TwainCap.CapInfo.Capability = L_CAP_DUPLEXENABLED
TwainCap.CapInfo.ConType = L_TWON_ONEVALUE

Dim RasVar As New LEADRasterVariant
RasVar.Type = VALUE_BOOLEAN
RasVar.BooleanValue = bEnable

TwainCap.CapOneValue.OneValItemType = L_TWTY_BOOL
TwainCap.CapOneValue.OneValCapValue = RasVar

nRet = RasterTwain.SetCapability2(TwainCap, L_LTWAIN_CAPABILITY_SET)
If nRet = 0 Then
MsgBox "The duplex capability is enabled"
Else
MsgBox "Can't enable duplex capability"
End If
End If
Else
MsgBox "Duplex capability is not supported in the selected driver"
End If

' try to acquire pages using duplex capability
RasterTwain.Acquire L_LTWAIN_SHOW_USER_INTERFACE Or L_LTWAIN_MODAL_USER_INTERFACE
End Sub


Twain Feeder : Tutorial #1 (Visual Basic)

Twain Feeder: Tutorial #1

Take the following steps to start a project and to add some code that acquires the images using Fast Twain:

1. | Start Visual Basic.
2. | Add the LEAD RasterTwain Object Library and LEAD Raster Variant Object Library to your project.
 | On the Project pull-down menu, use the References option, and select the LEAD RasterTwain Object Library (14).
 | On the Project pull-down menu, use the References option, and select the LEAD Raster Variant Object Library (14).
3. | Add the LEAD Raster IO Object Library to your project. On the Project pull-down menu, use the References option, and select the LEAD Raster IO Object Library (14).
4. | Add the following code to the general declarations section of your project:

Public TwainCap As New LEADTwainCapability
Public WithEvents RasterTwain As LEADRasterTwain

5.

Add the following code to the main form's Load procedure:

Set RasterTwain = New LEADRasterTwain
RasterTwain.InitSession hWnd
RasterTwain.EnableMethodErrors = False

6.

Add the following code to the main form's Unload procedure:

RasterTwain.EndSession

7. | Add the following button:
 | Name | Caption
 | cmdAcquire | Acquire
8. | Code the Acquire control's Click procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub cmdAcquire_Click()
Dim bEnable As Boolean
Dim nRet As Integer

RasterTwain.SelectSource

TwainCap.CapInfo.Capability = L_CAP_AUTOFEED
TwainCap.CapInfo.ConType = L_TWON_ONEVALUE

bEnable = True
Dim RasVar As New LEADRasterVariant
RasVar.Type  = VALUE_BOOLEAN
RasVar.BooleanValue
  = bEnable

TwainCap.CapOneValue.OneValItemType = L_TWTY_BOOL
TwainCap.CapOneValue.OneValCapValue = RasVar

nRet = RasterTwain.SetCapability2(TwainCap, L_LTWAIN_CAPABILITY_SET)
If nRet = 0 Then
MsgBox "AutoFeed capability is enabled"
Else
MsgBox "Can't enable AutoFeed capability"
End If

' try to acquire pages using AutoFeed capability
RasterTwain.Acquire L_LTWAIN_SHOW_USER_INTERFACE Or L_LTWAIN_MODAL_USER_INTERFACE
End Sub


Twain Feeder: Tutorial #2 (Visual Basic)

Twain Feeder: Tutorial #2

Take the following steps to start a project and to add some code that acquires the images using Fast Twain:

1. | Start Visual Basic.
2. | Add the LEAD RasterTwain Object Library and LEAD Raster Variant Object Library to your project.
 | On the Project pull-down menu, use the References option, and select the LEAD RasterTwain Object Library (14).
 | On the Project pull-down menu, use the References option, and select the LEAD Raster Variant Object Library (14).
3. | Add the LEAD Raster IO Object Library to your project. On the Project pull-down menu, use the References option, and select the LEAD Raster IO Object Library (14).
4. | Add the following code to the general declarations section of your project:

Public TwainCap As New LEADTwainCapability
Public WithEvents RasterTwain As LEADRasterTwain

5.

Add the following code to the main form's Load procedure:

Set RasterTwain = New LEADRasterTwain
RasterTwain.InitSession hWnd
RasterTwain.EnableMethodErrors = False

6.

Add the following code to the main form's Unload procedure:

RasterTwain.EndSession

7. | Add the following button:
 | Name | Caption
 | cmdAcquire | Acquire
8. | Code the Acquire control's Click procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub cmdAcquire_Click()
Dim nRet As Integer
Dim bEnable As Boolean

RasterTwain.SelectSource

TwainCap.CapInfo.Capability = L_CAP_FEEDERENABLED
TwainCap.CapInfo.ConType = L_TWON_ONEVALUE

bEnable = True
Dim RasVar As New LEADRasterVariant
RasVar.Type  = VALUE_BOOLEAN
RasVar.BooleanValue
  = bEnable

TwainCap.CapOneValue.OneValItemType = L_TWTY_BOOL
TwainCap.CapOneValue.OneValCapValue = RasVar

nRet = RasterTwain.SetCapability2(TwainCap, L_LTWAIN_CAPABILITY_SET)
If nRet = 0 Then
MsgBox "CAP_FEEDERENABLED capability is enabled"

' check if there is document loaded in the feeder
TwainCap.CapInfo.Capability = L_CAP_DUPLEX
TwainCap.CapInfo.ConType = L_TWON_ONEVALUE

nRet = RasterTwain.GetCapability2 (TwainCap, L_LTWAIN_CAPABILITY_GETVALUES)
If nRet = 0 Then
' check if the selected driver supports duplex capability
bEnable = TwainCap.CapOneValue.OneValCapValue.BooleanValue
If bEnable Then
MsgBox "There is document loaded in the feeder"
Else
MsgBox "There is no document loaded in the feeder"
End If
End If
Else
MsgBox "Can't enable AutoFeed capability"
End If

' try to acquire pages using CAP_FEEDERENABLED and CAP_FEEDERLOADED capabilities
RasterTwain.Acquire L_LTWAIN_SHOW_USER_INTERFACE Or L_LTWAIN_MODAL_USER_INTERFACE
End Sub


Miscellaneous Examples (Visual Basic)

LEADTOOLS Twain COM supports UNICODE. For more information on using the samples in this help file with UNICODE, please refer to A Special Note About UNICODE Support.

You can test any of the following examples by adding a command button to one of the previous lessons in the tutorial, and pasting the sample code in the Click procedure.

Acquire Example for Visual Basic

AcquireMulti Example for Visual Basic

AcquireSourceName Example for Visual Basic

Capability Example for Visual Basic

EnableShowUserInterfaceOnly Example for Visual Basic

EndSession Example for Visual Basic

FamilyName Example for Visual Basic

FastConfigEvent Example for Visual Basic

FindFastConfig Example for Visual Basic

GetCapability2 Example for Visual Basic

GetScanConfigs Example for Visual Basic

IsAvailable Example for Visual Basic

CapArray Example for Visual Basic

CapabilityLong Example for Visual Basic

CapEnum Example for Visual Basic

CapOneValue Example for Visual Basic

CapRange Example for Visual Basic

InitSession Example for Visual Basic

LoadTemplate Example for Visual Basic

LoadTemplateEvent2 Example for Visual Basic

PtwInfo Example for Visual Basic

QueryCapability Example for Visual Basic

RightMargin Example for Visual Basic

SaveTemplateEvent2 Example for Visual Basic

SelectedFamilyName Example for Visual Basic

SelectedSourceName Example for Visual Basic

SelectSource Example for Visual Basic

ShowTemplateDlg Example for Visual Basic

SourceName Example for Visual Basic

StopFeedPages Example for Visual Basic

UnlockSupport Example for Visual Basic

ImageEffects Example for Visual Basic

DataTransfer Example for Visual Basic

ImageResolution Example for Visual Basic

QueryFileSystem Example for Visual Basic

GetJPEGCompression Example for Visual Basic

SetJPEGCompression Example for Visual Basic

Transfer Options Example for Visual Basic

Resolution Example for Visual Basic

Image Frame Options Example for Visual Basic

Image Options Example for Visual Basic

Effects Example for Visual Basic

Progress Example for Visual Basic

Duplex Options Example for Visual Basic

RGB Response Example for Visual Basic


Acquire Example for Visual Basic

Dim RasterTwain As New LEADRasterTwain

RasterTwain.FileTransferName = "c:\twain.bmp"
MsgBox CStr(RasterTwain.MemBufSize)
nRet = RasterTwain.Acquire(L_LTWAIN_SHOW_USER_INTERFACE)
If (nRet <> 0) Then
MsgBox "Error Acquiring From Source", vbExclamation
End If
' Use this event to get the image passed to the LeadRasterView control that is needed internally
' in the Acquire method,
Private Sub RasterTwain_AcquirePageEvent(ByVal pBitmap As Long)
LEADRasterView1.Raster.InsertBitmapListItem -1, pBitmap
End Sub


AcquireMulti Example for Visual Basic

Private Sub RasterTwain_AcquireMultiEvent(ByVal nPage As Integer, ByVal bstrFileName As String, ByVal bFinishScan As Boolean)
Dim strMsg As String

If bFinishScan Then
strMsg = "The page # " + CStr(nPage) + " is scanned and saved to file name " + bstrFileName
MsgBox strMsg
End If
End Sub

Private Sub Command1_Click()
Dim nRet As Integer

RasterTwain.FastTransferMode = L_LTWAIN_BUFFER_MODE
RasterTwain.FastFormat = FILE_TIF
RasterTwain.FastBitsPerPixel = 1
RasterTwain.FastBufferSize = 0
RasterTwain.FastUsePreferredBufferSize = True
RasterTwain.EnableAcquireMultiEvent = True

nRet = RasterTwain.AcquireMulti("c:\Twain\test.tif", L_LTWAIN_SHOW_USER_INTERFACE, True)

If nRet = 0 Then
MsgBox "The Fast Twain method was successful", vbOKOnly, "Notice"
Else
MsgBox "Error occurred during the fast Twain method!!!", vbOKOnly, "Error!!!"
End If
End Sub


AcquireSourceName Example for Visual Basic

Public WithEvents RasterTwain As LEADRasterTwain
Public nRet As Integer

Private Sub Command1_Click()
RasterTwain.AcquireSourceName = "TWAIN Source Name"
nRet = RasterTwain.Acquire(L_LTWAIN_SHOW_USER_INTERFACE)
If (nRet <> 0) Then
MsgBox "Error acquiring from source", vbExclamation
End If
End Sub


Capability Example for Visual Basic

Public iRet As Integer
Public TwainCap As New LEADTwainCapability
Private Sub Test()
Dim RasterTwain As LEADRasterTwain
Dim strName As String
Dim lCount As Long
Dim lCapability As Long
Dim n As Integer
Dim CapVal As New LEADRasterVariant

lCount = RasterTwain.CapsCount
For n = 0 To lCount - 1 Step 1
lCapability = RasterTwain.Capability(n)

' Check for capability and do other processing
If lCapability = L_ICAP_XFERMECH Then
TwainCap.EnableMethodErrors = False
TwainCap.CapInfo.Capability = L_ICAP_XFERMECH
TwainCap.CapInfo.ConType = L_TWON_ONEVALUE
TwainCap.CapOneValue.OneValItemType = L_TWTY_UINT16
CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWSX_FILE
TwainCap.CapOneValue.OneValCapValue = CapVal

iRet = RasterTwain.SetCapability2(TwainCap, L_LTWAIN_CAPABILITY_SET)
End If
Next n
End Sub


CapabilityLong Example for Visual Basic

Public WithEvents RasterTwain As LEADRasterTwain
Dim TwainCap As LEADTwainCapability

Private Sub Command2_Click()
Dim iRet As Integer
Dim CapVal As New LEADRasterVariant
Set TwainCap = New LEADTwainCapability

TwainCap.CapInfo.ConType = L_TWON_ONEVALUE
TwainCap.CapInfo.CapabilityLong = L_ICAP_UNITS
TwainCap.EnableMethodErrors = False

CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWUN_INCHES

TwainCap.CapOneValue.OneValItemType = L_TWTY_UINT16
TwainCap.CapOneValue.OneValCapValue = CapVal

iRet = RasterTwain.SetCapability2(TwainCap, L_LTWAIN_CAPABILITY_SET)
If (iRet <> 0) Then
MsgBox "Error Setting Capability"
End If

Set TwainCap = Nothing
End Sub


CapArray Example for Visual Basic

Public WithEvents RasterTwain As LEADRasterTwain
Dim TwainCap As LEADTwainCapability

Private Sub Command4_Click()
Dim iRet As Integer
Dim CapVal As New LEADRasterVariant
Set TwainCap = New LEADRasterTwainCapability

TwainCap.CapInfo.ConType = L_TWON_ARRAY
TwainCap.CapInfo.Capability = L_ICAP_FILTER
TwainCap.EnableMethodErrors = False

TwainCap.CapArray.ArrayItemType = L_TWTY_UINT16
TwainCap.CapArray.ArrayNumOfItems = 2

CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWFT_RED
TwainCap.CapArray.ArrayCapValue(0) = CapVal
CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWFT_GREEN
TwainCap.CapArray.ArrayCapValue(1) = CapVal

iRet = RasterTwain.SetCapability2(TwainCap, L_LTWAIN_CAPABILITY_SET)
If (iRet <> 0) Then
MsgBox "Error Setting Capability"
End If

Set TwainCap = Nothing
End Sub


CapEnum Example for Visual Basic

Public WithEvents RasterTwain As LEADRasterTwain
Dim TwainCap As LEADTwainCapability

Private Sub Command3_Click()
Dim iRet As Integer
Dim CapVal As New LEADRasterVariant
Set TwainCap = New LEADRasterTwainCapability

TwainCap.CapInfo.ConType = L_TWON_ENUMERATION
TwainCap.CapInfo.Capability = L_ICAP_UNITS
TwainCap.EnableMethodErrors = False

TwainCap.CapEnum.EnumNumOfItems = 2

CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWUN_INCHES
TwainCap.CapEnum.EnumCapValue(0) = CapVal
CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWUN_TWIPS
TwainCap.CapEnum.EnumCapValue(1) = CapVal

TwainCap.CapEnum.EnumCurrentIndex = 0
TwainCap.CapEnum.EnumDefaultIndex = 0
TwainCap.CapEnum.EnumItemType = L_TWTY_UINT16

iRet = RasterTwain.SetCapability2(TwainCap, L_LTWAIN_CAPABILITY_SET)
If (iRet <> 0) Then
MsgBox "Error Setting Capability"
End If

Set TwainCap = Nothing
End Sub


CapOneValue Example for Visual Basic

Public WithEvents RasterTwain As LEADRasterTwain
Dim TwainCap As LEADTwainCapability

Private Sub Command2_Click()
Dim iRet As Integer
Dim CapVal As New LEADRasterVariant
Set TwainCap = New LEADTwainCapability

TwainCap.CapInfo.ConType = L_TWON_ONEVALUE
TwainCap.CapInfo.Capability = L_ICAP_UNITS
TwainCap.EnableMethodErrors = False

CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWUN_INCHES

TwainCap.CapOneValue.OneValItemType = L_TWTY_UINT16
TwainCap.CapOneValue.OneValCapValue = CapVal

iRet = RasterTwain.SetCapability2(TwainCap, L_LTWAIN_CAPABILITY_SET)
If (iRet <> 0) Then
MsgBox "Error Setting Capability"
End If

Set TwainCap = Nothing
End Sub


CapRange Example for Visual Basic

Public WithEvents RasterTwain As LEADRasterTwain
Dim TwainCap As LEADTwainCapability

Private Sub Command5_Click()
Dim iRet As Integer
Dim CapVal As New LEADRasterVariant
Set TwainCap = New LEADRasterTwainCapability

TwainCap.CapInfo.ConType = L_TWON_RANGE
TwainCap.CapInfo.Capability = L_ICAP_JPEGQUALITY
TwainCap.EnableMethodErrors = False

TwainCap.CapRange.RangeItemType = L_TWTY_INT16
CapVal.Type = VALUE_SHORT
CapVal.ShortValue = L_TWJQ_MEDIUM
TwainCap.CapRange.RangeCurrentValue = CapVal
CapVal.Type = VALUE_SHORT
CapVal.ShortValue = L_TWJQ_HIGH
TwainCap.CapRange.RangeDefaultValue = CapVal
CapVal.Type = VALUE_SHORT
CapVal.ShortValue =0
TwainCap.CapRange.RangeMinimumValue = CapVal
CapVal.Type = VALUE_SHORT
CapVal.ShortValue =50
TwainCap.CapRange.RangeMaximumValue = CapVal
CapVal.Type = VALUE_SHORT
CapVal.ShortValue = 10
TwainCap.CapRange.RangeStepSize = CapVal

iRet = RasterTwain.SetCapability2(TwainCap, L_LTWAIN_CAPABILITY_SET)
If (iRet <> 0) Then
MsgBox "Error Setting Capability"
End If

Set TwainCap = Nothing
End Sub


DataTransfer Example for Visual Basic

Private Sub Command3_Click()
Dim RasterTwain As LEADRasterTwain

Set RasterTwain = New LEADRasterTwain
RasterTwain.EnableMethodErrors = False
RasterTwain.InitSession hWnd

RasterTwain.GetProperties

RasterTwain.DataTransfer.FillOrder = L_TWBO_LSBFIRST
RasterTwain.DataTransfer.BufferMemoryCompression = L_TWCP_NONE
RasterTwain.DataTransfer.TransferMode = L_TWSX_MEMORY
RasterTwain.DataTransfer.ScanFileFormat = L_TWFF_BMP
RasterTwain.DataTransfer.MemoryBufferSize = 1024
RasterTwain.DataTransfer.EnableSaveMultipageFile = False
RasterTwain.DataTransfer.EnableAppendToFile = False
RasterTwain.DataTransfer.EnableDumpMemoryBuffersToFile = True
RasterTwain.FileTransferName = "c:\test.bmp"

RasterTwain.SetProperties
RasterTwain.EndSession
End Sub


Duplex Options Example for Visual Basic

Private Sub TestDuplexOptions()
Dim bEnableDuplex As Boolean
Dim nDuplexMode As Integer
Dim nMaxXfer As Integer

bEnableDuplex = RasterTwain.EnableDuplex
nDuplexMode = RasterTwain.DuplexMode
nMaxXfer = RasterTwain.MaxXferCount

If bEnableDuplex = False Then
RasterTwain.EnableDuplex = True
RasterTwain.DuplexMode = L_TWDX_1PASSDUPLEX
End If

If nMaxXfer <> 10 Then RasterTwain.MaxXferCount = 10
End Sub


Effects Example for Visual Basic

Private Sub TestEffects()
Dim fContrast As Single
Dim fHighlight As Single

fContrast = RasterTwain.ImageContrast
fHighlight = RasterTwain.ImageHighlight

Dim strMsg As String
strMsg = "Image Contrst = " + CStr(fContrast) + Chr(13) + "Image Highlight = " + CStr(fHighlight)
MsgBox strMsg

RasterTwain.ImageBrightness = 100#

RasterTwain.PaperSize = L_TWSS_A4
RasterTwain.PaperDirection = L_TWOR_LANDSCAPE
End Sub


EnableShowUserInterfaceOnly Example for Visual Basic

Dim RasterTwain As LEADRasterTwain
RasterTwain.EnableShowUserInterfaceOnly = True
RasterTwain.ShowTemplateDlg "c:\test.ltt"


EndSession Example for Visual Basic

Public Sub TestTwn()
Set RasterTwain = New LEADRasterTwain
Dim CapVal As New LEADRasterVariant
RasterTwain.InitSession hWnd

TwainCap.CapInfo.Capability = L_ICAP_XFERMECH
TwainCap.CapInfo.ConType = L_TWON_ONEVALUE
TwainCap.CapOneValue.OneValItemType = L_TWTY_UINT16
CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWSX_NATIVE

TwainCap.CapOneValue.OneValCapValue = CapVal

RasterTwain.SetCapability2 TwainCap, L_LTWAIN_CAPABILITY_SET

RasterTwain.Acquire L_LTWAIN_SHOW_USER_INTERFACE
RasterTwain.EndSession
End Sub


FamilyName Example for Visual Basic

Dim RasterTwain As LEADRasterTwain
Dim strBuffer As String
Dim lCount As Long
Dim n As Integer

lCount = RasterTwain.SourceCount
For n = 0 To lCount - 1 Step 1
strBuffer = "Source Name = " + RasterTwain.SourceName(n) + Chr(13) + _
"Product Family Name = " + RasterTwain.FamilyName(n) + Chr(13) + _
"Manufacturer Name = " + RasterTwain.ManufacturerName(n) + Chr(13)

MsgBox strBuffer
Next n


FastConfigEvent Example for Visual Basic

Private Sub RasterTwain_FastConfigEvent(ByVal pltResConfig As LTRASTERTWAINLib.ILTFastConfig)
Dim str As String
If pltResConfig.Success Then
str = "Transfer Mode = " + CStr(pltResConfig.TransferMode) + Chr(13) + _
"File Format = " + CStr(pltResConfig.FileFormat) + Chr(13) + _
"Buffer Size = " + CStr(pltResConfig.BufferSize) + Chr(13) + _
"Bits Per Pixel = " + CStr(pltResConfig.BitsPerPixel) + Chr(13) + _
"Required Time = " + CStr(pltResConfig.RequiredTime)

MsgBox str, vbOKOnly, "Resulting Scan Configurations..."
Else
MsgBox "The tested scan configuration failed…"
EndIf
RasterTwain.StopFindFastConfig = False
End Sub


FindFastConfig Example for Visual Basic

Private Sub RasterTwain_FastConfigEvent(ByVal pltResConfig As LTRASTERTWAINLib.ILTFastConfig)
' ... set your code here

RasterTwain.StopFindFastConfig = False
End Sub

Private Sub Command4_Click()
Dim nRet As Integer
Dim str As String

'Unlock Document support.
'Note that this is a sample key, which will not work in your toolkit.
RasterTwain.UnlockSupport L_SUPPORT_DOCUMENT, "TestKey"
RasterTwain.EnableFastConfigEvent = True
RasterTwain.UserFastConfigsCount = 2

RasterTwain.UserFastConfigs(0).TransferMode = L_LTWAIN_FILE_MODE
RasterTwain.UserFastConfigs(0).FileFormat = FILE_BMP
RasterTwain.UserFastConfigs(0).BitsPerPixel = 1

RasterTwain.UserFastConfigs(1).TransferMode = L_LTWAIN_FILE_MODE
RasterTwain.UserFastConfigs(1).FileFormat = FILE_TIF
RasterTwain.UserFastConfigs(1).BitsPerPixel = 1

nRet = RasterTwain. FindFastConfig ("c:\Twain", L_LTWAIN_SHOW_USER_INTERFACE, 1, 1)

If nRet = 0 Then
MsgBox "FindFastConfig method was successful"
MsgBox "Result Scan Configs count = " + CStr(RasterTwain.FastConfigsResultCount)

str = "Transfer Mode = " + CStr(RasterTwain.FastConfigsResult(0).TransferMode) + Chr(13) + _
"File Format = " + CStr(RasterTwain.FastConfigsResult(0).FileFormat) + Chr(13) + _
"Buffer Size = " + CStr(RasterTwain.FastConfigsResult(0).BufferSize) + Chr(13) + _
"Required Time = " + CStr(RasterTwain.FastConfigsResult(0).RequiredTime)

MsgBox str, vbOKOnly, "Result Scan Configurations..."

str = "Transfer Mode = " + CStr(RasterTwain.BestFastConfig.TransferMode) + Chr(13) + _
"File Format = " + CStr(RasterTwain.BestFastConfig.FileFormat) + Chr(13) + _
"Buffer Size = " + CStr(RasterTwain.BestFastConfig.BufferSize) + Chr(13) + _
"Required Time = " + CStr(RasterTwain.BestFastConfig.RequiredTime)

MsgBox str, vbOKOnly, "Resulting Scan Configurations..."
Else
MsgBox "Error occurred in the FindFastConfig method!!!", vbOKOnly, "Error!!!"
End If
End Sub


GetCapability2 Example for Visual Basic

Public WithEvents RasterTwain As LEADRasterTwain
Dim TwainCap As LEADTwainCapability

Private Sub Command1_Click()
Dim iRet As Integer
Set TwainCap = New LEADTwainCapability

TwainCap.CapInfo.ConType = L_TWON_DONTCARE16
TwainCap.CapInfo.Capability = L_ICAP_UNITS
iRet = RasterTwain.GetCapability2(TwainCap, L_LTWAIN_CAPABILITY_GETCURRENT)
If (iRet <> 0) Then
MsgBox "Error Getting Capability"
End If

Set TwainCap = Nothing
End Sub


GetJPEGCompression Example for Visual Basic

Private Sub TestGetJPEGCompression()
Dim nRet As Integer

nRet = RasterTwain.GetJPEGCompression (L_LTWAIN_GET_JPEG_COMPRESSION)
If nRet = 0 Then
Dim strJpegData As String
strJpegData = "Color Space = " + CStr(RasterTwain.JPEGCompressionData.ColorSpace) + Chr(13) + _

"QuantMap = " + CStr(RasterTwain.JPEGCompressionData.QuantMap (0)) + Chr(13) + _
"GetHuffmanMap = " + CStr(RasterTwain.JPEGCompressionData.HuffmanMap (0)) + Chr(13) + _
"GetQuantTable Flags = " + CStr(RasterTwain.JPEGCompressionData.QuantTable(0).Flags) + Chr(13) + _
"GetQuantTable Length = " + CStr(RasterTwain.JPEGCompressionData.QuantTable(0).Length) + Chr(13) + _
"GetQuantTable Data = " + CStr(RasterTwain.JPEGCompressionData.QuantTable(0).Data) + Chr(13) + _
"GetHuffmanDC Flags = " + CStr(RasterTwain.JPEGCompressionData.HuffmanDC(0).Flags) + Chr(13) + _
"GetHuffmanDC Data = " + CStr(RasterTwain.JPEGCompressionData.HuffmanDC (0).Data) + Chr(13) + _
"GetHuffmanAC Flags = " + CStr(RasterTwain.JPEGCompressionData.HuffmanAC (0).Flags) + Chr(13) + _
"GetHuffmanAC Data = " + CStr(RasterTwain.JPEGCompressionData.HuffmanAC(0).Data)

MsgBox strJpegData
End If
End Sub


GetScanConfigs Example for Visual Basic

Private Sub Command5_Click()
Dim nRet As Integer
Dim str As String

'Unlock Document support.
'Note that this is a sample key, which will not work in your toolkit.
RasterTwain.UnlockSupport L_SUPPORT_DOCUMENT, "TestKey"

nRet = RasterTwain.GetScanConfigs(1, L_LTWAIN_BUFFER_MODE, 5)
If nRet = 0 Then
MsgBox "GetScanConfigs method was successful."
MsgBox "Scan Configuration count = " + CStr(RasterTwain.ScanConfigCount)

str = "Transfer Mode = " + CStr(RasterTwain.ScanConfig(0).TransferMode) + Chr(13) + _
"File Format = " + CStr(RasterTwain.ScanConfig(0).FileFormat) + Chr(13) + _
"Buffer Size = " + CStr(RasterTwain.ScanConfig(0).BufferSize) + Chr(13) + _
"Required Time = " + CStr(RasterTwain.ScanConfig(0).RequiredTime)

MsgBox str, vbOKOnly, "Scan Configurations..."
Else
MsgBox "Error occurred in the GetScanConfigs method!!!", vbOKOnly, "Error!!!"
End If
End Sub


Image Frame Options Example for Visual Basic

Private Sub TestImageFrameOptions()
Dim Frame As ItwFrame
Frame = RasterTwain.ImageFrame

Frame.LeftMargin = 0
Frame.TopMargin = 0
Frame.RightMargin = 8.5
Frame.BottomMargin = 11
RasterTwain.ImageFrame = Frame
End Sub


Image Options Example for Visual Basic

Private Sub TestImageOptions()
Dim nBPP As Integer
Dim nUnit As Integer

nUnit = RasterTwain.ImageUnit
nBPP = RasterTwain.ImageBitsPerPixel

If nUnit <> L_TWUN_INCHES Then RasterTwain.ImageUnit = L_TWUN_INCHES
If nBPP <> 24 Then RasterTwain.ImageBitsPerPixel = 24
End Sub


ImageEffects Example for Visual Basic

Private Sub Command1_Click()
Dim RasterTwain As LEADRasterTwain

Set RasterTwain = New LEADRasterTwain
RasterTwain.EnableMethodErrors = False
RasterTwain.InitSession hWnd

RasterTwain.GetProperties

RasterTwain.ImageEffects.PixelFlavor = L_TWPF_VANILLA
RasterTwain.ImageEffects.ColorScheme = L_TWPT_BW
RasterTwain.ImageEffects.HighLight = 50#
RasterTwain.ImageEffects.Shadow = 50#
RasterTwain.ImageEffects.Brightness = 500#
RasterTwain.ImageEffects.Contrast = 100#

MsgBox "Current used Halftone = " + RasterTwain.ImageEffects.HalfTone
RasterTwain.SetProperties
RasterTwain.EndSession
End Sub


ImageResolution Example for Visual Basic

Private Sub Command2_Click()
Dim RasterTwain As LEADRasterTwain

Set RasterTwain = New LEADRasterTwain
RasterTwain.EnableMethodErrors = False
RasterTwain.InitSession hWnd

RasterTwain.GetProperties

RasterTwain.ImageResolution.Unit = L_TWUN_INCHES
RasterTwain.ImageResolution.BitsPerPixel = 1
RasterTwain.ImageResolution.HorizontalResolution = 150
RasterTwain.ImageResolution.VerticalResolution = 150
RasterTwain.ImageResolution.XScaling = 1
RasterTwain.ImageResolution.YScaling = 1
RasterTwain.ImageResolution.RotationAngle = 90#

RasterTwain.LeftMargin = 0
RasterTwain.RightMargin = 0
RasterTwain.TopMargin = 200
RasterTwain.BottomMargin = 200

RasterTwain.EnableAutoFeed = True
RasterTwain.MaxPagesNumber = -1

MsgBox "Duplex state = " + RasterTwain.DuplexScanning

RasterTwain.SetProperties
RasterTwain.EndSession
End Sub


InitSession Example for Visual Basic

Dim nRet As Integer
Dim RasterTwain As New LEADRasterTwain

RasterTwain.EnableMethodErrors = False
RasterTwain.ManName = "LEAD Technologies, Inc."
RasterTwain.ProdFamily= "LEAD Twain COM Object"
RasterTwain.Version = "Version 14"
RasterTwain.AppName = "LEADTools Twain test sample"
nRet = RasterTwain.InitSession(hWnd)
If (nRet <> 0) Then
MsgBox "Error Initializing Twain", vbExclamation
End If


IsAvailable Example for Visual Basic

'check the status of TWAIN
Dim RasterTwain As New LEADRasterTwain
Dim bTwn As Boolean

bTwn = RasterTwain.IsAvailable (Me.hWnd)
If bTwn Then
MsgBox "Twain is installed"
Else
MsgBox "Twain is not installed"
End If


LoadTemplate Example for Visual Basic

Dim RasterTwain As LEADRasterTwain
Dim CapVal As LEADRasterVariant
RasterTwain.LoadTemplate "c:\test.ltt"

TwainCap.CapInfo.Capability = L_ICAP_XFERMECH
TwainCap.CapInfo.ConType = L_TWON_ONEVALUE
TwainCap.CapOneValue.OneValItemType = L_TWTY_UINT16
CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWSX_NATIVE

TwainCap.CapOneValue.OneValCapValue = CapVal

RasterTwain.SetCapability2 TwainCap, L_LTWAIN_CAPABILITY_SET

RasterTwain.SaveTemplate "c:\test.ltt"


LoadTemplateEvent2 Example for Visual Basic

Public WithEvents RasterTwain As LEADRasterTwain
Private Sub Command2_Click()
RasterTwain.EnableLoadTemplateEvent = True

RasterTwain.LoadTemplate "c:\test.ltt"
End Sub

Private Sub RasterTwain_LoadTemplateEvent2(ByVal pCapability As LTRASTERTWAINLib.ILEADTwainCapability)
' ...
' ...
' set your code here
' ...
End Sub


Progress Example for Visual Basic

Private Sub TestProgress()
RasterTwain.ShowProgress (True)
End Sub


PtwInfo Example for Visual Basic

Public WithEvents RasTwain As LEADRasterTwain
Private Sub RasterTwain_AcquirePageEvent(ByVal pBitmap As Long)
' This sample code is for the AcquirePageEvent handler
' For another example, refer to the tutorials
Dim nRet As Integer, n As Integer
Dim twExt As New twExtImageInfo

If (Not twExt Is Nothing) Then
twExt.NumOfInfos = 1
twExt.ptwInfo(0).InfoID = L_TWEI_BARCODETEXT
twExt.ptwInfo(0).ItemType = L_TWTY_UINT32
nRet = RasTwain.GetExtImageInfo (twExt)
If (nRet = 0) Then
If (twExt.ptwInfo(0).CondCode = L_TWCC_SUCCESS) Then
For n = 0 To twExt.ptwInfo(0).NumOfItems - 1 Step 1
Item = twExt.ptwInfo(0).Item(n, 0)
' Do more processing on the item value
Next n
End If
End If
End If
End Sub


QueryCapability Example for Visual Basic

Dim iRet As Integer
Dim RasterTwain As New LEADRasterTwain
Dim TwainCap As New LEADRasterTwainCapability

TwainCap.ConType = L_TWON_DONTCARE16
TwainCap.Capability = L_ICAP_UNITS

iRet = RasterTwain.QueryCapability(TwainCap)
If (iRet <> 0) Then
MsgBox "Error Getting Capability"
End If


QueryFileSystem Example for Visual Basic

Public WithEvents RasterTwain As LEADRasterTwain

Private Sub TestTwainFileSystem()
Dim nRet As Integer
nRet = RasterTwain.QueryFileSystem(FILESYSTEM_MSG_AUTOMATICCAPTUREDIRECTORY)
If nRet <> 0 Then
MsgBox "Error occurred during call QueryFileSystem"
End If

Dim Msg As String

Msg = "Input Name = " + RasterTwain.FileSystemInfo.InputName + Chr(13) + _
"Output Name = " + RasterTwain.FileSystemInfo.OutputName + Chr(13) + _
"Recursive = " + RasterTwain.FileSystemInfo.Recursive + Chr(13) + _
"FileType = " + RasterTwain.FileSystemInfo.FileType + Chr(13) + _
"FileSize = " + RasterTwain.FileSystemInfo.FileSize + Chr(13) + _
"CreateTimeDate = " + RasterTwain.FileSystemInfo.CreateTimeDate + Chr(13) + _
"ModifiedTimeDate = " + RasterTwain.FileSystemInfo.ModifiedTimeDate + Chr(13) + _
"FreeMediaSpace = " + RasterTwain.FileSystemInfo.FreeMediaSpace + Chr(13) + _
"NewImageSize = " + RasterTwain.FileSystemInfo.NewImageSize + Chr(13) + _
"NumberOfFiles = " + RasterTwain.FileSystemInfo.NumberOfFiles + Chr(13) + _
"NumberOfAudioSnippets = " + RasterTwain.FileSystemInfo.NumberOfAudioSnippets + Chr(13) + _
"DeviceGroupMask = " + RasterTwain.FileSystemInfo.DeviceGroupMask

MsgBox Msg
End Sub


Resolution Example for Visual Basic

Private Sub TestResoultion()
RasterTwain.XResolution = 300#
RasterTwain.YResolution = 300#
End Sub


RGB Response Example for Visual Basic

Private Sub TestRGBResponse()
RasterTwain.RGBElementsCount = 2

RasterTwain.RGBElements (0).Index = 0
RasterTwain.RGBElements(0).Channel1 = 0
RasterTwain.RGBElements(0).Channel2 = 0
RasterTwain.RGBElements(0).Channel3 = 0

RasterTwain.RGBElements(1).Index = 1
RasterTwain.RGBElements(1).Channel1 = 255
RasterTwain.RGBElements(1).Channel2 = 255
RasterTwain.RGBElements(1).Channel3 = 255

RasterTwain.SetRGBResponse L_TWAIN_RGB_RESPONSE_SET, 1
End Sub


RightMargin Example for Visual Basic

Dim twFrm As New twFrame
Dim CapVal As New LEADRasterVariant

TwainCap.EnableMethodErrors = False
TwainCap.CapInfo.Capability = L_TWUN_INCHES
TwainCap.CapInfo.ConType = L_TWON_ONEVALUE
TwainCap.CapOneValue.OneValItemType = L_TWTY_UINT16
CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWUN_INCHES
TwainCap.CapOneValue.OneValCapValue = CapVal

twFrm.RightMargin = 0
twFrm.LeftMargin = 0
twFrm.BottomMargin = 10
twFrm.TopMargin = 10

TwainCap.EnableMethodErrors = False
TwainCap.CapInfo.Capability = L_ICAP_FRAMES
TwainCap.CapInfo.ConType = L_TWON_ONEVALUE
TwainCap.CapOneValue.OneValItemType = L_TWTY_FRAME
CapVal.Type = VALUE_DISPATCH
CapVal.DispatchValue = twFrm
TwainCap.CapOneValue.OneValCapValue = CapVal

RasterTwain.SetCapability2 TwainCap, L_LTWAIN_CAPABILITY_SET


SaveTemplateEvent2 Example for Visual Basic

Public WithEvents RasterTwain As LEADRasterTwain
Private Sub Command2_Click()
RasterTwain.EnableSaveTemplateEvent = True

RasterTwain.SaveTemplate "c:\test.ltt"
End Sub

Private Sub RasterTwain_SaveTemplateEvent2(ByVal pCapability As LTRASTERTWAINLib.ILEADTwainCapability)
' ...
' ...
' set your code here
' ...
End Sub


SelectedFamilyName Example for Visual Basic

Dim RasterTwain As LEADRasterTwain
Dim strBuffer As String

strBuffer = "Source Name = " + RasterTwain.SelectedSourceName + Chr(13) + _
"Product Family Name = " + RasterTwain.SelectedFamilyName + Chr(13) + _
"Manufacturer Name = " + RasterTwain.SelectedManufacturerName

MsgBox strBuffer


SelectedSourceName Example for Visual Basic

Dim RasterTwain As LEADRasterTwain

MsgBox "The current selected source is: " + RasterTwain.SelectedSourceName


SelectSource Example for Visual Basic

Dim RasterTwain As LEADRasterTwain
Dim nRet As Integer
nRet = RasterTwain.SelectSource
If (nRet <> 0) Then
MsgBox "Error Selecting Source", vbExclamation
End If


SetJPEGCompression Example for Visual Basic

Private Sub TestJPEGCompression()
Dim nRet As Integer
nRet = RasterTwain.GetJPEGCompression(L_LTWAIN_GET_JPEG_COMPRESSION)
If nRet = 0 Then
RasterTwain.JPEGCompressionData.ColorSpace = L_TWPT_GRAY
RasterTwain.JPEGCompressionData.SubSampling= &H10001000
RasterTwain.JPEGCompressionData.NumComponents= 1
RasterTwain.JPEGCompressionData.RestartFrequency= 0
RasterTwain.JPEGCompressionData.QuantMap(0) = 0
RasterTwain.JPEGCompressionData.HuffmanMap (0) = 0

nRet = RasterTwain.SetJPEGCompression(L_LTWAIN_SET_JPEG_COMPRESSION)
If nRet = 0 Then
MsgBox "Set JPEG compression options is success"
End If
End If
End Sub


ShowTemplateDlg Example for Visual Basic

Dim RasterTwain As LEADRasterTwain
RasterTwain.ShowTemplateDlg "c:\test.ltt"


SourceName Example for Visual Basic

Dim RasterTwain As LEADRasterTwain
Dim strName As String
Dim lCount As Long
Dim n As Integer

lCount = RasterTwain.SourceCount
For n = 0 To lCount - 1 Step 1
strName = RasterTwain.SourceName(n)
' Do More processing on source name
Next n


StopFeedPages Example for Visual Basic

Public WithEvents RasterTwain As LEADRasterTwain

Private Sub Command1_Click()
Dim nRet As Integer

' select ADF option from the user interface
nRet = RasterTwain.Acquire(L_LTWAIN_SHOW_USER_INTERFACE)
If (nRet <> 0) Then
MsgBox "Error Acquiring From Source", vbExclamation
End If
' To get the image passed to LeadRasterView, which is needed internally in the Acquire method,
' you should invoke this event
End Sub

Private Sub RasterTwain_AcquirePageEvent(ByVal pBitmap As Long)
LEADRasterView1.Raster.InsertBitmapListItem -1, pBitmap
RasterTwain.StopFeedPages = False
End Sub


Transfer Options Example for Visual Basic

Private Sub TestTransferOptions()
RasterTwain.GetTransferOptions

RasterTwain.TransferMode = L_TWAIN_TRANSFER_FILE
RasterTwain.TransferFileName = "c:\\test.bmp"
RasterTwain.TransferFileFormat = L_TWFF_BMP
RasterTwain.TransferCompressionType = L_TWCP_NONE

RasterTwain.SetTransferOptions

If RasterTwain.IsFileTransferAvailable Then
MsgBox "File transfer is supported"
End If
If RasterTwain.IsMemoryTransferAvailable Then
MsgBox "Memory transfer is supported"
End If
If RasterTwain.IsNativeTransferAvailable Then
MsgBox "Native transfer is supported"
End If
End Sub


UnlockSupport Example for Visual Basic

If RasterTwain.IsSupportLocked(L_SUPPORT_DOCUMENT) Then
RasterTwain.UnlockSupport L_SUPPORT_DOCUMENT, "TestKey"
End If


Tutorial for Visual C++ 5.0 Programmers

The following topics provide brief and simple examples to help you learn how to use the LEAD RasterTwain Object Library.

For general information about the syntax requirements of this interface, refer to Visual C++ 5.0 Syntax .

LEADTOOLS Twain COM supports UNICODE. For more information on using the samples in this help file with UNICODE, please refer to A Special Note About UNICODE Support.

Note:

These tutorial examples are intended to be easy to understand and easy to test. The example programs in the EXAMPLES subdirectory provide more in depth design and more detailed code.

Acquiring an Image

Using the Fast TWAIN Feature

Get a Fast Twain Scan from a Scanner

Set/Get a Twain Capability

Twain Duplex (Visual C++ 5.0)

Twain Feeder: Tutorial # 1 (Visual C++ 5.0)

Twain Feeder: Tutorial # 2 (Visual C++ 5.0)

Miscellaneous Examples


Acquiring an Image (C++ 5.0 and later)

The following steps are to help you create an application that will use the ILEADRasterTwain Object Library.

1. | Start with the project that you created in Loading and Displaying an Image .
2. | Add the #import and #include statements to your program so you can access LEAD RasterTwain Object Library:
 | a. | In the Project Workspace, click the FileView tab.
 | b. | Double-click the tutor files folder to open it.
 | c. | Double-click the Header Files folder to open it.
 | d. | Double-click the StdAfx.h file to edit it.
 | e. | Add the following lines to the end of the file (keep in mind, you may have to change the path to where the dll's reside):

#import "c:\\winnt\\system32\\ltrvr14n.dll" no_namespace, named_guids
#import "c:\\winnt\\system32\\ltr14n.dll" no_namespace, named_guids
#import "c:\\winnt\\system32\\ltrtn14n.dll" no_namespace, named_guids

3. | Add an ILEADRasterTwain pointer to the class and set it to NULL in the constructor.
 | a. | In the Project Workspace, click the Class View tab.
 | b. | Select the CTutorDlg class.
 | c. | Right-click and choose "Add Member Variable".
 | d. | For Variable Type enter ILEADRasterTwain.
 | e. | For Variable Declaration enter *m_pRasterTwain.
 | f. | Leave Access as Public.
 | g. | Click the OK button.
 | h. | In the Class View tab, double-click the CTutorDlg constructor function.
 | i. | Add the following line to the end of the constructor:

m_pRasterTwain = NULL;

4. | Add an ILEADRaster pointer to the class and set it to NULL in the constructor.
 | a. | In the Project Workspace, click the Class View tab.
 | b. | Select the CTutorDlg class.
 | c. | Right-click and choose "Add Member Variable".
 | d. | For Variable Type enter ILEADRaster.
 | e. | For Variable Declaration enter *m_pRaster.
 | f. | Leave Access as Public.
 | g. | Click the OK button.
 | h. | In the Class View tab, double-click the CTutorDlg constructor function.
 | i. | Add the following line to the end of the constructor:

m_pRaster = NULL;

5. | Go to the Project WorkSpace and click the Resource View tab. Double-click Dialog and double-click IDD_TUTOR_DIALOG to bring up the application's dialog box.
6. | Add four new buttons at the top of the form. To do this for each button, select the button control on the Controls toolbar. Then, click and drag to position the button on the dialog box. Then double-click the button to change its properties. Set the properties as follows:
 | ID | Caption
 | IDC_SELECTSOURCE | Select Source
 | IDC_ACQUIRE | Acquire
 | IDC_SAVE_TEMPLATE | Save Template File
 | IDC_LOAD_TEMPLATE | Load Template File
7. | Add three Radio buttons in addition to the above buttons.
 | ID | Caption
 | IDC_NATIVE | Native Transfer
 | IDC_MEMORY | Memory Transfer
 | IDC_FILE | File Transfer
8. | Add the following code to the end of OnInitDialog before the return statement:

if (m_pRasterTwain == NULL)
{
CoCreateInstance(
CLSID_LEADRasterTwain,
NULL,
CLSCTX_ALL,
IID_ILEADRasterTwain,
(void**)&m_pRasterTwain);
}

if (m_pRasterTwain == NULL)
return FALSE;

m_pRasterTwain->InitSession ((long)GetSafeHwnd());
m_pRasterTwain->put_EnableMethodErrors(TRUE);

9. | To end the Twain session and free memory allocated by the COM object, add the following code in the destructor of the CTutorDlg. To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | In the Class name combo box, select CTutorDlg.
 | b. | In the Object IDs list box, select CTutorDlg.
 | c. | In the Messages list box, select WM_DESTROY.
 | d. | Click the Add Function button. Choose OK for the default function name (OnDestroy).
 | e. | Click the Edit Code button to enter the following code before CDialog::OnDestroy().

if (m_pRasterTwain)
{
m_pRasterTwain->EndSession ();
m_pRaster->Release ();
}

10. | Add code for the select source button (IDC_SELECTSOURCE). To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | Click the Message Maps tab.
 | b. | In the Class Name combo box, select CTutorDlg.
 | c. | In the Object IDs list box, select IDC_SELECTSOURCE.
 | d. | In the Messages list box, select BN_CLICKED.
 | e. | Click the Add Function button. Choose OK for the default function name (OnSelectSource).
 | f. | Click the Edit Code button to start entering the code.

void CTutorDlg::OnSelectSource()
{
if (m_pRasterTwain)
m_pRasterTwain->SelectSource ();
}

11. | Add code for the acquire button (IDC_ACQUIRE). To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | Click the Message Maps tab.
 | b. | In the Class Name combo box, select CTutorDlg.
 | c. | In the Object IDs list box, select IDC_ACQUIRE.
 | d. | In the Messages list box, select BN_CLICKED.
 | e. | Click the Add Function button. Choose OK for the default function name (OnAcquire).
 | f. | Click the Edit Code button to enter the following code in the OnAcquire function.

if (m_pRasterTwain)
m_pRasterTwain->Acquire (L_LTWAIN_SHOW_USER_INTERFACE);

12. | Add code for the save template button (IDC_SAVE_TEMPLATE). To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | Click the Message Maps tab.
 | b. | In the Class Name combo box, select CTutorDlg.
 | c. | In the Object IDs list box, select IDC_SAVE_TEMPLATE.
 | d. | In the Messages list box, select BN_CLICKED.
 | e. | Click the Add function button. Choose OK for the default function name (OnSaveTemplate).
 | f. | Click the Edit Code button to enter the following code in the OnSaveTemplate function.

if (m_pRasterTwain)
m_pRasterTwain->SaveTemplate ("c:\\test.ltt");

13. | Add code for the load template button (IDC_LOAD_TEMPLATE). To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | Click the Message Maps tab.
 | b. | In the Class Name combo box, select CTutorDlg.
 | c. | In the Object IDs list box, select IDC_LOAD_TEMPLATE.
 | d. | In the Messages list box, select BN_CLICKED.
 | e. | Click the Add function button. Choose OK for the default function name (OnLoadTemplate).
 | f. | Click the Edit Code button to enter the following code in the OnLoadTemplate function.

if (m_pRasterTwain)
m_pRasterTwain->LoadTemplate("c:\\test.ltt");

14. | Add a variable in the CTutorDlg class for the Transfer Mode. To do so, do the following:
 | a. | In the Project Workspace, click the Class View tab.
 | b. | Select the CTutorDlg class
 | c. | Right-click and choose "Add Member Variable"
 | d. | For Variable Type enter unsigned short.
 | e. | For Variable Declaration enter m_XferMode.
 | f. | Leave Access as Public
 | g. | Click the OK button
 | h. | In the Class View tab, double-click the CTutorDlg constructor function
 | i. | Add the following line to the end of the construtor

m_XferMode = L_TWSX_NATIVE;

15. | Add code for the transfer mode buttons (IDC_NATIVE, IDC_MEMORY, IDC_FILE). To do so, press Ctrl-W to go to the MFC Class Wizard, then do the following:
 | a. | Click the Message Maps tab.
 | b. | In the Class Name combo box, select CTutorDlg.
 | c. | In the Object IDs list box, select IDC_NATIVE.
 | d. | In the Messages list box, select BN_CLICKED.
 | e. | Click the Add Function button. Choose OK for the default function name (OnNative).
 | f. | Click the Edit Code button to start entering the code.
 | g. | Repeat the above steps for IDC_MEMORY and IDC_FILE buttons.
16. | Add the following code in the (OnNative) function.

ILEADRasterVariant * CapVal = NULL;
CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL,
IID_ILEADRasterVariant, (void **)& CapVal);

m_XferMode = L_TWSX_NATIVE;

CapVal->Type = VALUE_USHORT;
CapVal->LongValue = m_XferMode;

TwainSetCapability (L_ICAP_XFERMECH, CapVal, L_TWTY_UINT16);
CapVal->Release();

17.

Add the following code in the (OnMemory) function.

ILEADRasterVariant * CapVal = NULL;
CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL,
IID_ILEADRasterVariant, (void **)& CapVal);

m_XferMode = L_TWSX_MEMORY;

CapVal->Type = VALUE_USHORT;
CapVal->LongValue = m_XferMode;

TwainSetCapability (L_ICAP_XFERMECH, CapVal, L_TWTY_UINT16);
CapVal->Release();

18.

Add the following code in the (OnFile) function.

ILEADRasterVariant * CapVal = NULL;
CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL,
IID_ILEADRasterVariant, (void **)& CapVal);

m_XferMode = L_TWSX_FILE;

CapVal->Type = VALUE_USHORT;
CapVal->LongValue = m_XferMode;

TwainSetCapability (L_ICAP_XFERMECH, CapVal, L_TWTY_UINT16);
m_pRasterTwain->put_ FileTransferName (CString("c:\\twain.bmp").AllocSysString());

CapVal->Release();

19. | To define the TwainSetCapability function used above do the following:
 | a. | In the Project Workspace, click the Class View tab.
 | b. | Select the CTutorDlg class
 | c. | Right-click and choose "Add Member Function"
 | d. | For Function Type enter int.
 | e. | For Function Declaration enter TwainSetCapability(UINT uCapability, ILEADRasterVariant * CapVal, UINT uItemType).
 | f. | Leave Access as Public
 | g. | Click the OK button.
 | h. | Add the following code to the CTutorDlg::TwainSetCapability function:

short iRet;
HRESULT hr;
ICapability * pCapability = NULL;
ICapabilityOneValue * pCapOV = NULL;

hr = ::CoCreateInstance (CLSID_LEADRasterTwainCapability, NULL, CLSCTX_ALL, IID_ICapability, (void **)&pCapability);
if (FAILED (hr) || pCapability == NULL)
return 1;

pCapability->QueryInterface (IID_ICapabilityOneValue, (void **)&pCapOV);
if (!pCapOV)
{
pCapability->Release ();
return 1;
}

pCapability->put_Capability (uCapability);
pCapability->put_ConType (L_TWON_ONEVALUE);

pCapOV->put_OneValItemType (uItemType);
pCapOV->put_OneValCapValue (CapVal);

iRet = m_pRasterTwain->SetCapability (pCapability, L_LTWAIN_CAPABILITY_SET);

pCapOV->Release ();
pCapability->Release ();

return iRet;

20.

To add the code for the twain events, edit the TUTORDLG.H file and change the definition of CTutorDlg : CDialog by inserting the following lines after DECLARE_MESSAGE_MAP()

public:
CRasterTwainSink *m_pRasterTwainSink;
IConnectionPoint *m_pCP;
DWORD m_dwCookie;

21.

Edit the TUTORDLG.CPP file and add the following code to the end of the OnInitDialog function:

m_pRasterTwainSink = new CRasterTwainSink;
m_pRasterTwainSink->m_pDlg = this;
//Attach the twain object to the raster view control
IDispatch *pDispatch=NULL;
(m_LEADRasterView1.GetControlUnknown())->QueryInterface(IID_IDispatch, (void**)&pDispatch);
if(pDispatch)
pDispatch->Release();

//Establish a connection between source and sink.
LPUNKNOWN pUnkSink = m_pRasterTwainSink->GetIDispatch(FALSE);
AfxConnectionAdvise(m_pRasterTwain, DIID__LEADRasterTwainEvents, pUnkSink, FALSE, &m_dwCookie);

22. | Press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | Click the Add Class button.
 | b. | Click New....
 | c. | Type CRasterTwainSink for the name of the class
 | d. | Select CCmdTarget for the base class of the new class.
 | e. | Under Automation, click the Automation Radio button.
 | f. | Click OK to create the class.
 | g. | In the RasterTwainSink.h file, move the destructor so that it is public:

// Implementation
virtual ~CRasterTwainSink();
protected:

h.

In the RasterTwainSink.h file, add the following to the CRasterTwainSink class in the //Attributes public section:

// Attributes
public:
CTutorDlg *m_pDlg;

i.

In the RasterTwainSink.cpp file, add the following to the top of the file (after the #include "RasterTwainSink.h")

#include "tutorDlg.h"
#include "leadraster.h"

j.

In the RasterTwainSink.h file, add the following line

class CTutorDlg;

before class CRasterTwainSink : public CCmdTarget

23. | Add #include statements so you can access the new class:
 | a. | In the Project Workspace, click the File View tab.
 | b. | Double-click the tutor files folder to open it.
 | c. | Double-click the Header Files folder to open it.
 | d. | Double-click the StdAfx.h file to edit it.
 | e. | Add the following lines to the end of the file:

#include <AFXCTL.H>
#include "RasterTwainSink.h"

24. | Edit the header for the Sink class:
 | a. | In the Project Workspace, click the File View tab.
 | b. | Double-click the tutor files folder to open it.
 | c. | Double-click the Header Files folder to open it.
 | d. | Double-click the RasterTwainSink.h file to edit it.
 | e. | Add the following just before //}}AFX_MSG:

afx_msg void OnAcquire(long pBitmap);
afx_msg void OnSaveTemplate(IUnknown * pCapability);
afx_msg void OnLoadTemplate(IUnknown * pCapability);

25. | Edit the source for the Sink class:
 | a. | In the Project Workspace, click the File View tab.
 | b. | Double-click the tutor files folder to open it.
 | c. | Double-click the Source Files folder.
 | d. | Double-click the RasterTwainSink.cpp file to edit it.
 | e. | Add the following code in between the BEGIN_DISPATCH_MAP(CRasterTwainSink, CCmdTarget) and END_DISPATCH_MAP():

DISP_FUNCTION_ID(CRasterTwainSink, "AcquirePageEvent", 1, OnAcquire, VT_EMPTY,VTS_I4)
DISP_FUNCTION_ID(CRasterTwainSink, "SaveTemplateEvent", 2, OnSaveTemplate, VT_EMPTY, VTS_UNKNOWN)
DISP_FUNCTION_ID(CRasterTwainSink, "LoadTemplateEvent", 3, OnLoadTemplate, VT_EMPTY, VTS_UNKNOWN)

f.

Inside the BEGIN_INTERFACE_MAP section, change the INTERFACE_PART to the following:

INTERFACE_PART(CRasterTwainSink, DIID__LEADRasterTwainEvents, Dispatch)

 | g. | Add the following to the end of the file:
26. | In the OnDestroy function add the following code to the beginning of it:

LPUNKNOWN pUnkSink = m_pRasterTwainSink->GetIDispatch(FALSE);
AfxConnectionUnadvise(m_pRasterTwain, DIID__LEADRasterTwainEvents, pUnkSink, FALSE, m_dwCookie);
delete m_pRasterTwainSink;

27.

Add code in the RasterTwainSink.cpp:

void CRasterTwainSink::OnAcquire (long pBitmap)
{
// Do Code To Notify Getting a Page.
m_pDlg->m_LEADRasterView1.GetRaster().InsertBitmapListItem (-1, pBitmap);
}
void CRasterTwainSink::OnSaveTemplate(IUnknown * pCapability)
{
//Do Code To Modify Capability.
}
void CRasterTwainSink::OnLoadTemplate(IUnknown * pCapability)
{
//Do Code To Modify Capability.
}

28.

Compile and run your program to test it.


Using the Fast TWAIN Feature (C++ 5.0 and later)

Take the following steps to start a project and to add some code that acquires the images using the LEADTOOLS Fast TWAIN feature:

1. | Start a new project as follows:
 | Run Microsoft Visual C++ 5.0, select the File >New menu option, and do the following:
 | a. | Click the Projects tab.
 | b. | Select MFC AppWizard (exe) as the project type
 | c. | In the Project name text box, specify tutor.
 | d. | In the Location text box, specify the path of the project.
 | e. | Click the OK button.
2. | In the Step 1 dialog box, do the following:
 | a. | Select Dialog based.
 | b. | Click the Next button.
3. | In the Step 2 of 4 dialog box, do the following:
 | a. | Ensure that About Box is selected.
 | b. | Ensure that 3D Controls is selected.
 | c. | Select ActiveX Controls
 | d. | Click the Next button.
4. | In the Step 3 of 4 dialog box, do the following:
 | a. | For comments, ensure that Yes, Please is selected.
 | b. | For how to use the MFC library, select Use MFC in a Shared DLL.
 | c. | Click the Next button.
5. | In the Step 4 of 4 dialog box, just click Finish.
6. | Read New Project Information, and click OK. (The AppWizard creates the project files and opens the project.)
7. | Add #import and #include statements to your program so you can access the LEAD COM constants and classes:
 | a. | In the Project Workspace, click the FileView tab.
 | b. | Double-click the tutor files folder to open it.
 | c. | Double-click the Header Files folder to open it.
 | d. | Double-click the StdAfx.h file to edit it.
 | Add the following lines to the end of the file (keep in mind, you may have to change the path to where the dll's reside):

#import "c:\\winnt\\system32\\ltrvr14n.dll" no_namespace, named_guids
#import "c:\\winnt\\system32\\ltrtn14n.dll" no_namespace, named_guids
#import "c:\\winnt\system32\\ltrio14n.dll" no_namespace, named_guids

8. | Add an ILEADRasterTwain pointer to the class and set it to NULL in the constructor.
 | a. | In the Project Workspace, click the Class View tab.
 | b. | Select the CTutorDlg class.
 | c. | Right-click and choose "Add Member Variable".
 | d. | For Variable Type enter ILEADRasterTwain.
 | e. | For Variable Declaration enter *m_pRasterTwain.
 | f. | Leave Access as Public.
 | g. | Click the OK button.
 | h. | In the Class View tab, double-click the CTutorDlg constructor function.
 | i. | Add the following line to the end of the constructor:

m_pRasterTwain = NULL;

9. | Go to the Project WorkSpace and click the Resource View tab. Double-click Dialog and double-click IDD_TUTOR_DIALOG to bring up the application's dialog box.
10. | Add 1 check box. To do this, select the check box control on the Controls toolbar. Then, click and drag to position the button on the dialog box. Then double-click the check box to change its properties. Set the properties as follows:
 | ID | Caption
 | IDC_USEBUFFERSIZE | Use Buffer Size
11. | Add two Radio buttons in addition to the above buttons.
 | ID | Caption
 | IDC_NATIVE | Native Mode
 | IDC_MEMORY | Memory Mode
12. | Add the following button:
 | ID | Caption
 | IDC_ACQUIRE | Fast Acquire
13. | Add the following two text boxes and name them as follows:
 | ID
 | IDC_BUFFERSIZE
 | IDC_FILENAME
14. | Add the following code to the end of OnInitDialog before the return statement:

if (m_pRasterTwain == NULL)
{
CoCreateInstance(CLSID_LEADRasterTwain, NULL, CLSCTX_ALL, IID_ILEADRasterTwain, (void**)&m_pRasterTwain);
}

if (m_pRasterTwain == NULL)
return FALSE;

m_pRasterTwain->InitSession ((long)GetSafeHwnd());
m_pRasterTwain->put_EnableMethodErrors(TRUE);
CheckDlgButton(IDC_MEMORY, TRUE);

15. | To end the Twain session and free memory allocated by the COM object, add the following code in the destructor of the CTutorDlg. To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | In the Class name combo box, select CTutorDlg.
 | b. | In the Object IDs list box, select CTutorDlg.
 | c. | In the Messages list box, select WM_DESTROY.
 | d. | Click the Add Function button. Choose OK for the default function name (OnDestroy).
 | e. | Click the Edit Code button to enter the following code before CDialog::OnDestroy().

if (m_pRasterTwain)
{
m_pRasterTwain->EndSession();
m_pRaster->Release ();
}

16. | Add the following member variables for the following controls. To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | Select Member variables tab
 | b. | In the Class name combo box, select CTutorDlg.
 | c. | Select the following control and add for each one the following member variable by press Add variable button for each control.

ID | Member variable | Type
IDC_USEBUFFERSIZE | m_bUseBufferSize | BOOL
IDC_BUFFERSIZE | m_nBufferSize | int
IDC_FILENAME | m_csFileName | CString

 | d. | Press Ok.
17. | Add code for the select source button (IDC_ACQUIRE). To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | Click the Message Maps tab.
 | b. | In the Class Name combo box, select CTutorDlg.
 | c. | In the Object IDs list box, select IDC_ACQUIRE.
 | d. | In the Messages list box, select BN_CLICKED.
 | e. | Click the Add Function button. Choose OK for the default function name (OnAcquire).
 | f. | Click the Edit Code button to start entering the code.

void CTutorDlg::OnAcquire()
{
UpdateData();

BOOL bMemory = IsDlgButtonChecked(IDC_MEMORY);
if (bMemory)
{
m_pRasterTwain->FastTransferMode = L_LTWAIN_BUFFER_MODE;
m_pRasterTwain->FastFormat = FILE_CCITT_GROUP4;
}
else
{
m_pRasterTwain->FastTransferMode = L_LTWAIN_NATIVE_MODE;
m_pRasterTwain->FastFormat = FILE_TIF;
}

m_pRasterTwain->FastBitsPerPixel = 1;
m_pRasterTwain->FastUsePreferredBufferSize = m_bUseBufferSize;
m_pRasterTwain->FastBufferSize = m_nBufferSize;

BSTR bstrFName = m_csFileName.AllocSysString();
short iRet = m_pRasterTwain->AcquireMulti(bstrFName, L_LTWAIN_SHOW_USER_INTERFACE | L_LTWAIN_USE_THREAD_MODE, TRUE);

SysFreeString(bstrFName);
if (iRet == 0)
AfxMessageBox(TEXT("Fast Scanning process done successfully..."));
else
{
CString csError;
csError.Format(TEXT("AcquireMulti failed, Error = %d\n"), iRet);
AfxMessageBox(csError);
}
}

18.

Compile and run your program to test it.


Get a Fast Twain Scan from a Scanner (Visual C++ 5.0)

Take the following steps to start a project and to add some code to find the fastest configuration for your scanner using the LEADTOOLS Fast TWAIN feature:

1. | Start a new project as follows:
 | Run Microsoft Visual C++ 5.0, select the File >New menu option, and do the following:
 | a. | Click the Projects tab.
 | b. | Select MFC AppWizard (exe) as the project type.
 | c. | In the Project name text box, specify tutor.
 | d. | In the Location text box, specify the path of the project.
 | e. | Click the OK button.
2. | In the Step 1 dialog box, do the following:
 | a. | Select Dialog based.
 | b. | Click the Next button.
3. | In the Step 2 of 4 dialog box, do the following:
 | a. | Ensure that About Box is selected.
 | b. | Ensure that 3D Controls is selected.
 | c. | Select ActiveX Controls.
 | d. | Click the Next button.
4. | In the Step 3 of 4 dialog box, do the following:
 | a. | For comments, ensure that Yes, Please is selected.
 | b. | For how to use the MFC library, select Use MFC in a Shared DLL.
 | c. | Click the Next button.
5. | In the Step 4 of 4 dialog box, just click Finish.
6. | Read the New Project Information, and click OK. (The AppWizard creates the project files and opens the project.)
7. | Add #import and #include statements to your program so you can access the LEAD COM constants and classes:
 | a. | In the Project Workspace, click the FileView tab.
 | b. | Double-click the tutor files folder to open it.
 | c. | Double-click the Header Files folder to open it.
 | d. | Double-click the StdAfx.h file to edit it.
 | Add the following lines to the end of the file (keep in mind, you may have to change the path to where the dll's reside):

#import "c:\\winnt\\system32\\ltrvr14n.dll" no_namespace, named_guids
#import "c:\\winnt\\system32\\ltr14n.dll" no_namespace, named_guids
#import "c:\\winnt\\system32\\ltrtn14n.dll" no_namespace, named_guids

8. | Add an ILEADRasterTwain pointer to the class and set it to NULL in the constructor.
 | a. | In the Project Workspace, click the Class View tab.
 | b. | Select the CTutorDlg class.
 | c. | Right-click and choose "Add Member Variable".
 | d. | For Variable Type enter ILEADRasterTwain.
 | e. | For Variable Declaration enter *m_pRasterTwain.
 | f. | Leave Access as Public.
 | g. | Click the OK button.
 | h. | In the Class View tab, double-click the CTutorDlg constructor function.
 | i. | Add the following line to the end of the constructor:

m_pRasterTwain = NULL;

9. | Go to the Project WorkSpace and click the Resource View tab. Double-click Dialog and double-click IDD_TUTOR_DIALOG to bring up the application's dialog box.
10. | Add 3 buttons. To do this, select the button control on the Controls toolbar. Then, click and drag to position the button on the dialog box. Then double-click the button to change its properties. Set the properties as follows:
 | ID | Caption
 | ID_SELECT_SOURCE | Select Source
 | ID_FIND_FAST_CONFIG | Find Fast Config
 | ID_ACQUIRE_FAST_CONFIG | Acquire Fast Config
11. | Add the following code to the end of OnInitDialog before the return statement:

CoInitialize(NULL);

HRESULT hr = CoCreateInstance (CLSID_LEADRasterTwain, NULL, CLSCTX_ALL, IID_ILEADRasterTwain, (void **)&m_pRasterTwain);
if (SUCCEEDED(hr))
{
m_pRasterTwain->put_ManName (CString("LEAD Technologies, Inc.").AllocSysString());
m_pRasterTwain->put_ProdFamily (CString("LEAD Twain COM Object").AllocSysString());
m_pRasterTwain->put_Version (CString("Version 14").AllocSysString());
m_pRasterTwain->put_AppName (CString("LEADTools Twain test sample").AllocSysString());

short iRet = m_pRasterTwain->InitSession ((long)m_hWnd);
if (iRet != 0)
AfxMessageBox(TEXT("Error Initializing Twain"));

m_pRasterTwain->EnableMethodErrors = FALSE;

/* Unlock Document support.
Note that this is a sample key, which will not work in your toolkit. */
m_pRasterTwain->UnlockSupport (L_SUPPORT_DOCUMENT, "TestKey");
}

12. | To end the Twain session and free memory allocated by the COM object, add the following code in the destructor of the CTutorDlg. To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | In the Class name combo box, select CTutorDlg.
 | b. | In the Object IDs list box, select CTutorDlg.
 | c. | In the Messages list box, select WM_DESTROY.
 | d. | Click the Add Function button. Choose OK for the default function name (OnDestroy).
 | e. | Click the Edit Code button to enter the following code before CDialog::OnDestroy().

if (m_pRasterTwain)
{
m_pRasterTwain->EndSession ();
}

CoUninitialize();

13. | Add code for the select source button (ID_SELECT_SOURCE). To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | Click the Message Maps tab.
 | b. | In the Class Name combo box, select CTutorDlg.
 | c. | In the Object IDs list box, select ID_SELECT_SOURCE.
 | d. | In the Messages list box, select BN_CLICKED.
 | e. | Click the Add Function button. Choose OK for the default function name (OnSelectSource).
 | f. | Click the Edit Code button to start entering the code.

void CTutorDlg::OnSelectSource()
{
if (m_pRasterTwain)
m_pRasterTwain->SelectSource ();
}

14. | Add code for the select source button (ID_FIND_FAST_CONFIG). To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | Click the Message Maps tab.
 | b. | In the Class Name combo box, select CTutorDlg.
 | c. | In the Object IDs list box, select ID_FIND_FAST_CONFIG.
 | d. | In the Messages list box, select BN_CLICKED.
 | e. | Click the Add Function button. Choose OK for the default function name (OnFindFastConfig).
 | f. | Click the Edit Code button to start entering the code.

void CTutorDlg::OnFindFastConfig()
{
m_pRasterTwain->UserFastConfigsCount = 0;
m_pRasterTwain->EnableFastConfigEvent = FALSE;
short iRet = m_pRasterTwain->FindFastConfig ("c:\\temp", L_LTWAIN_SHOW_USER_INTERFACE | L_LTWAIN_USE_THREAD_MODE, 8, 5);

if (iRet == 0)
MessageBox(TEXT("The Find Fast Configuration process completed."), TEXT("Fast Config"), MB_OK);
else
MessageBox(TEXT("An error occurred during the Finding Fast Configuration process."), TEXT("Fast Config"), MB_OK);
}

15. | Add code for the select source button (ID_ACQUIRE_FAST_CONFIG). To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | Click the Message Maps tab.
 | b. | In the Class Name combo box, select CTutorDlg.
 | c. | In the Object IDs list box, select ID_ACQUIRE_FAST_CONFIG.
 | d. | In the Messages list box, select BN_CLICKED.
 | e. | Click the Add Function button. Choose OK for the default function name (OnAcquireFastConfig).
 | f. | Click the Edit Code button to start entering the code.

void CTutorDlg::OnAcquireFastConfig()
{
m_pRasterTwain->FastTransferMode = m_pRasterTwain->GetBestFastConfig()->TransferMode;
m_pRasterTwain->FastFormat = m_pRasterTwain->GetBestFastConfig()->FileFormat;
m_pRasterTwain->FastBitsPerPixel = m_pRasterTwain->GetBestFastConfig()->BitsPerPixel;
m_pRasterTwain->FastBufferSize = m_pRasterTwain->GetBestFastConfig()->BufferSize;

m_pRasterTwain->FastUsePreferredBufferSize = TRUE;
m_pRasterTwain->EnableAcquireMultiEvent = FALSE;

short iRet = m_pRasterTwain->AcquireMulti ("c:\\temp\\test", L_LTWAIN_SHOW_USER_INTERFACE, TRUE);

if (iRet == 0)
MessageBox(TEXT("Image acquisition using the Fast TWAIN Configuration is completed."), TEXT("Fast Config"), MB_OK);
else
MessageBox(TEXT("An error occurred while acquiring an image using the Fast TWAIN Configuration."), TEXT("Fast Config"), MB_OK);
}

16.

Compile and test the program.


Set/Get a Twain Capability (Visual C++ 5.0)

Take the following steps to start a project and to add some code to use Get/Set capabuilty methods and then acquire your image using new set capability:

1. | Start a new project as follows:
 | Run Microsoft Visual C++ 5.0, select the File >New menu option, and do the following:
 | a. | Click the Projects tab.
 | b. | Select MFC AppWizard (exe) as the project type
 | c. | In the Project name text box, specify tutor.
 | d. | In the Location text box, specify the path of the project.
 | e. | Click the OK button.
2. | In the Step 1 dialog box, do the following:
a. | Select Dialog based.
b. | Click the Next button.
3. | In the Step 2 of 4 dialog box, do the following:
 | a. | Ensure that About Box is selected.
 | b. | Ensure that 3D Controls is selected.
 | c. | Select ActiveX Controls
 | d. | Click the Next button.
4. | In the Step 3 of 4 dialog box, do the following:
 | a. | For comments, ensure that Yes, Please is selected.
 | b. | For how to use the MFC library, select Use MFC in a Shared DLL.
 | c. | Click the Next button.
5. | In the Step 4 of 4 dialog box, just click Finish.
6. | Read New Project Information, and click OK. (The AppWizard creates the project files and opens the project.)
7. | Add #import and #include statements to your program so you can access the LEAD COM constants and classes:
 | a. | In the Project Workspace, click the FileView tab.
 | b. | Double-click the tutor files folder to open it.
 | c. | Double-click the Header Files folder to open it.
 | d. | Double-click the StdAfx.h file to edit it.
 | Add the following lines to the end of the file (keep in mind, you may have to change the path to where the dll's reside):

#import "c:\\winnt\\system32\\ltrvr14n.dll" no_namespace, named_guids
#import "c:\\winnt\\system32\\ltr14n.dll" no_namespace, named_guids
#import "c:\\winnt\\system32\\ltrtn14n.dll" no_namespace, named_guids
#import "c:\\winnt\\system32\\ltrio14n.dll" no_namespace, named_guids

8. | Add an ILEADRasterTwain pointer to the class and set it to NULL in the constructor.
 | a. | In the Project Workspace, click the Class View tab.
 | b. | Select the CTutorDlg class.
 | c. | Right-click and choose "Add Member Variable".
 | d. | For Variable Type enter ILEADRasterTwain.
 | e. | For Variable Declaration enter *m_pRasterTwain.
 | f. | Leave Access as Public.
 | g. | Click the OK button.
 | h. | In the Class View tab, double-click the CTutorDlg constructor function.
 | i. | Add the following line to the end of the constructor:

m_pRasterTwain = NULL;

9. | Go to the Project WorkSpace and click the Resource View tab. Double-click Dialog and double-click IDD_TUTOR_DIALOG to bring up the application's dialog box.
10. | Add 4 buttons. To do this, select the check box control on the Controls toolbar. Then, click and drag to position the button on the dialog box. Then double-click the check box to change its properties. Set the properties as follows:
 | ID | Caption
 | ID_SELECT_SOURCE | Select Source
 | ID_USE_CAPABILITY | Use Capability
 | ID_SET_BRIGHTNESS | Set Brightness
 | ID_ACQUIRE | Acquire
11. | Add the following code to the end of OnInitDialog before the return statement:

CoInitialize(NULL);

HRESULT hr = CoCreateInstance (CLSID_LEADRasterTwain, NULL, CLSCTX_ALL, IID_ILEADRasterTwain, (void **)&m_pRasterTwain);
if (SUCCEEDED(hr))
{
m_pRasterTwain->put_ManName (CString("LEAD Technologies, Inc.").AllocSysString());
m_pRasterTwain->put_ProdFamily (CString("LEAD Twain COM Object").AllocSysString());
m_pRasterTwain->put_Version (CString("Version 14").AllocSysString());
m_pRasterTwain->put_AppName (CString("LEADTools Twain test sample").AllocSysString());

short iRet = m_pRasterTwain->InitSession ((long)m_hWnd);
if (iRet != 0)
AfxMessageBox(TEXT("Error Initializing Twain"));

m_pRasterTwain->EnableMethodErrors = FALSE;

/* Unlock Document support.
Note that this is a sample key, which will not work in your toolkit. */
m_pRasterTwain->UnlockSupport (L_SUPPORT_DOCUMENT, "TestKey");
}

12. | To end the Twain session and free memory allocated by the COM object, add the following code in the destructor of the CTutorDlg. To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | In the Class name combo box, select CTutorDlg.
 | b. | In the Object IDs list box, select CTutorDlg.
 | c. | In the Messages list box, select WM_DESTROY.
 | d. | Click the Add Function button. Choose OK for the default function name (OnDestroy).
 | e. | Click the Edit Code button to enter the following code before CDialog::OnDestroy().

if (m_pRasterTwain)
{
m_pRasterTwain->EndSession ();
}

CoUninitialize();

13. | Add code for the select source button (ID_SELECT_SOURCE). To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | Click the Message Maps tab.
 | b. | In the Class Name combo box, select CTutorDlg.
 | c. | In the Object IDs list box, select ID_SELECT_SOURCE.
 | d. | In the Messages list box, select BN_CLICKED.
 | e. | Click the Add Function button. Choose OK for the default function name (OnSelectSource).
 | f. | Click the Edit Code button to start entering the code.

void CTutorDlg::OnSelectSource()
{
if (m_pRasterTwain)
m_pRasterTwain->SelectSource ();
}

14. | Add code for the select source button (ID_USE_CAPABILITY). To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | Click the Message Maps tab.
 | b. | In the Class Name combo box, select CTutorDlg.
 | c. | In the Object IDs list box, select ID_USE_CAPABILITY.
 | d. | In the Messages list box, select BN_CLICKED.
 | e. | Click the Add Function button. Choose OK for the default function name (OnUseCapability).
 | f. | Click the Edit Code button to start entering the code.

void CTutorDlg::OnUseCapability()
{
ICapability * pGetCap = NULL;
ICapabilityOneValue * pGetCapOV = NULL;
ILEADRasterVariant * CapVal = NULL;

CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL,
IID_ILEADRasterVariant, (void **)&CapVal);

HRESULT hr = ::CoCreateInstance (CLSID_LEADRasterTwainCapability, NULL, CLSCTX_ALL, IID_ICapability, (void **)&pGetCap);
if (FAILED (hr) || pGetCap == NULL)
return;

pGetCap-> EnableMethodErrors = VARIANT_FALSE;
pGetCap-> ConType = L_TWON_DONTCARE16;
pGetCap-> Capability = L_ICAP_XFERMECH;

short iRet = m_pRasterTwain->GetCapability (pGetCap, L_LTWAIN_CAPABILITY_GETCURRENT);
if (iRet == 0)
{
pGetCap->QueryInterface(IID_ICapabilityOneValue, (void **)&pGetCapOV);
if (!pGetCapOV)
{
pGetCap->Release ();
return;
}

CapVal = pGetCapOV-> OneValCapValue ;

if (CapVal->LongValue != L_TWSX_FILE)
{
ICapability * pSetCap = NULL;
ICapabilityOneValue * pSetCapOV = NULL;
ILEADRasterVariant * SetCap = NULL;

CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL,
IID_ILEADRasterVariant, (void **)&SetCap);

::CoCreateInstance (CLSID_LEADRasterTwainCapability, NULL, CLSCTX_ALL, IID_ICapability, (void **)&pSetCap);

pSetCap-> EnableMethodErrors = VARIANT_FALSE;
pSetCap-> Capability = L_ICAP_XFERMECH;
pSetCap-> ConType = L_TWON_ONEVALUE;

pSetCap->QueryInterface(IID_ICapabilityOneValue, (void **)&pSetCapOV);

SetCap->Type = VALUE_USHORT;
SetCap->LongValue = L_TWSX_FILE;

pSetCapOV-> OneValItemType = L_TWTY_UINT16;
pSetCapOV-> OneValCapValue = SetCap;

short iRet = m_pRasterTwain-> SetCapability (pSetCap, L_LTWAIN_CAPABILITY_SET);

pSetCapOV->Release ();
pSetCap->Release ();
SetCap->Release();
}
else
MessageBox(TEXT("The Transfer mode is File."), TEXT("Set Capability"), MB_OK);

pGetCapOV->Release ();
pGetCap->Release ();
}
else
MessageBox(TEXT("Error occurred in the GetCapability method"), TEXT("Error!"), MB_OK);

CapVal->Release ();
}

15. | Add code for the select source button (ID_SET_BRIGHTNESS). To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | Click the Message Maps tab.
 | b. | In the Class Name combo box, select CTutorDlg.
 | c. | In the Object IDs list box, select ID_SELECT_SOURCE.
 | d. | In the Messages list box, select BN_CLICKED.
 | e. | Click the Add Function button. Choose OK for the default function name (OnSetBrightness).
 | f. | Click the Edit Code button to start entering the code.

void CTutorDlg::OnSetBrightness()
{
ICapability * pCap = NULL;
ICapabilityOneValue * pCapOV = NULL;
ILEADRasterVariant * CapVal = NULL;
CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL,
IID_ILEADRasterVariant, (void **)&CapVal);

HRESULT hr = ::CoCreateInstance(CLSID_LEADRasterTwainCapability, NULL, CLSCTX_ALL, IID_ICapability, (void **)&pCap);
if (FAILED (hr) || pCap == NULL)
return;

pCap-> EnableMethodErrors = VARIANT_FALSE;
pCap-> ConType = L_TWON_ONEVALUE;
pCap-> Capability = L_ICAP_BRIGHTNESS;

pCap->QueryInterface(IID_ICapabilityOneValue, (void **)&pCapOV);

CapVal->Type = VALUE_FLOAT;
CapVal->FloatValue = 50;

pCapOV-> OneValItemType = L_TWTY_FIX32;
pCapOV-> OneValCapValue = CapVal;

short iRet = m_pRasterTwain-> SetCapability (pCap, L_LTWAIN_CAPABILITY_SET);

pCapOV->Release ();
pCap->Release ();
CapVal->Release ();
}

16. | Add code for the select source button (ID_ACQUIRE). To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | Click the Message Maps tab.
 | b. | In the Class Name combo box, select CTutorDlg.
 | c. | In the Object IDs list box, select ID_ACQUIRE.
 | d. | In the Messages list box, select BN_CLICKED.
 | e. | Click the Add Function button. Choose OK for the default function name (OnAcquire).
 | f. | Click the Edit Code button to start entering the code.

void CTutorDlg::OnAcquire()
{
m_pRasterTwain->FileTransferName = CString("c:\\twain.bmp").AllocSysString();
short iRet = m_pRasterTwain->Acquire (L_LTWAIN_SHOW_USER_INTERFACE);
if (iRet != 0)
MessageBox (TEXT("Error Acquiring From Source"));
}

17.

Compile and test the program.


Twain Duplex (Visual C++ 5.0)

Take the following steps to start a project:

1. | Start a new project as follows:
 | Run Microsoft Visual C++ 5.0, select the File >New menu option, and do the following:
 | a. | Click the Projects tab.
 | b. | Select MFC AppWizard (exe) as the project type.
 | c. | In the Project name text box, specify tutor.
 | d. | In the Location text box, specify the path of the project.
 | e. | Click the OK button.
2. | In the Step 1 dialog box, do the following:
 | a. | Select Dialog based.
 | b. | Click the Next button.
3. | In the Step 2 of 4 dialog box, do the following:
 | a. | Ensure that About Box is selected.
 | b. | Ensure that 3D Controls is selected.
 | c. | Select ActiveX Controls.
 | d. | Click the Next button.
4. | In the Step 3 of 4 dialog box, do the following:
 | a. | For comments, ensure that Yes, Please is selected.
 | b. | For how to use the MFC library, select Use MFC in a Shared DLL.
 | c. | Click the Next button.
5. | In the Step 4 of 4 dialog box, just click Finish.
6. | Read the New Project Information, and click OK. (The AppWizard creates the project files and opens the project.)
7. | Add #import and #include statements to your program so you can access the LEAD COM constants and classes:
 | a. | In the Project Workspace, click the FileView tab.
 | b. | Double-click the tutor files folder to open it.
 | c. | Double-click the Header Files folder to open it.
 | d. | Double-click the StdAfx.h file to edit it.
8. | Add the following lines to the end of the file (keep in mind, you may have to change the path to where the dll's reside):

#import "c:\\winnt\\system32\\ltrvr14n.dll" no_namespace, named_guids
#import "c:\\winnt\\system32\\ltrtn14n.dll" no_namespace, named_guids
#import "c:\\winnt\system32\\ltrio14n.dll" no_namespace, named_guids

9. | Add an ILEADRasterTwain pointer to the class and set it to NULL in the constructor.
 | a. | In the Project Workspace, click the Class View tab.
 | b. | Select the CTutorDlg class.
 | c. | Right-click and choose "Add Member Variable".
 | d. | For Variable Type enter ILEADRasterTwain.
 | e. | For Variable Declaration enter *m_pRasterTwain.
 | f. | Leave Access as Public.
 | g. | Click the OK button.
 | h. | In the Class View tab, double-click the CTutorDlg constructor function.
 | i. | Add the following line to the end of the constructor:

m_pRasterTwain = NULL;

10. | Go to the Project WorkSpace and click the Resource View tab. Double-click Dialog and double-click IDD_TUTOR_DIALOG to bring up the application's dialog box.
11. | Add the following button:
 | ID | Caption
 | IDC_ACQUIRE | Acquire
12. | Add the following code to the end of OnInitDialog before the return statement:

if (m_pRasterTwain == NULL)
{
CoCreateInstance(CLSID_LEADRasterTwain, NULL, CLSCTX_ALL, IID_ILEADRasterTwain, (void**)&m_pRasterTwain);
}

if (m_pRasterTwain == NULL)
return FALSE;

m_pRasterTwain->InitSession ((long)GetSafeHwnd());
m_pRasterTwain->put_EnableMethodErrors (TRUE);

13. | To end the Twain session and free memory allocated by the COM object, add the following code in the destructor of the CTutorDlg. To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | In the Class name combo box, select CTutorDlg.
 | b. | In the Object IDs list box, select CTutorDlg.
 | c. | In the Messages list box, select WM_DESTROY.
 | d. | Click the Add Function button. Choose OK for the default function name (OnDestroy).
 | e. | Click the Edit Code button to enter the following code before CDialog::OnDestroy().

if (m_pRasterTwain)
{
m_pRasterTwain->EndSession();
}

14. | Add code for the select source button (IDC_ACQUIRE). To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | Click the Message Maps tab.
 | b. | In the Class Name combo box, select CTutorDlg.
 | c. | In the Object IDs list box, select IDC_ACQUIRE.
 | d. | In the Messages list box, select BN_CLICKED.
 | e. | Click the Add Function button. Choose OK for the default function name (OnAcquire).
 | f. | Click the Edit Code button to start entering the code.

void CTutorDlg::OnAcquire()
{
int nRet = 0;
ILEADTwainCapability *pTwainCap;

m_pRasterTwain->SelectSource();

CoCreateInstance(CLSID_LEADTwainCapability, NULL, CLSCTX_ALL, IID_ILEADTwainCapability, (void**)&pTwainCap);

pTwainCap->CapInfo->Capability = L_CAP_DUPLEX;
pTwainCap->CapInfo->ConType = L_TWON_ONEVALUE;

nRet = m_pRasterTwain->GetCapability2 (pTwainCap, L_LTWAIN_CAPABILITY_GETVALUES);
if (nRet == 0)
{
// check if the selected driver supports duplex capability
if (pTwainCap->CapOneValue->OneValItemType != L_TWTY_UINT16)
{
m_pRasterTwain->EndSession();
return;
}

int item = pTwainCap->CapOneValue->OneValCapValue->LongValue;

switch (item)
{
case L_TWDX_NONE:
AfxMessageBox(TEXT("Duplex capability is not supported in the selected driver"));
break;
case L_TWDX_1PASSDUPLEX:
AfxMessageBox(TEXT("1 Pass Duplex capability is supported in the selected driver"));
break;
case L_TWDX_2PASSDUPLEX:
AfxMessageBox(TEXT("2 Pass Duplex capability is supported in the selected driver"));
break;
}

// make sure the duplex capability is enabled
if (item != L_TWDX_NONE)
{
BOOL bEnable = TRUE;

pTwainCap->CapInfo->Capability = L_CAP_DUPLEXENABLED;
pTwainCap->CapInfo->ConType = L_TWON_ONEVALUE;

ILEADRasterVariant * pRasVar = NULL;
CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL, IID_ILEADRasterVariant, (void**)&pRasVar);

pRasVar->Type = VALUE_BOOLEAN;
pRasVar->BooleanValue = bEnable;

pTwainCap->CapOneValue->OneValItemType = L_TWTY_BOOL;
pTwainCap->CapOneValue->OneValCapValue = pRasVar;

nRet = m_pRasterTwain->SetCapability2(pTwainCap, L_LTWAIN_CAPABILITY_SET);
if (nRet == 0)
AfxMessageBox(TEXT("The duplex capability is enabled"));
else
AfxMessageBox(TEXT("Can't enable duplex capability"));
}
}
else
AfxMessageBox(TEXT("Duplex capability is not supported in the selected driver"));

// try to acquire pages using duplex capability
m_pRasterTwain->Acquire(L_LTWAIN_SHOW_USER_INTERFACE || L_LTWAIN_MODAL_USER_INTERFACE);
}

15.

Compile and test the program.


Twain Feeder: Tutorial # 1 (Visual C++ 5.0)

Take the following steps to start a project:

1. | Start a new project as follows:
 | Run Microsoft Visual C++ 5.0, select the File >New menu option, and do the following:
 | a. | Click the Projects tab.
 | b. | Select MFC AppWizard (exe) as the project type.
 | c. | In the Project name text box, specify tutor.
 | d. | In the Location text box, specify the path of the project.
 | e. | Click the OK button.
2. | In the Step 1 dialog box, do the following:
 | a. | Select Dialog based.
 | b. | Click the Next button.
3. | In the Step 2 of 4 dialog box, do the following:
 | a. | Ensure that About Box is selected.
 | b. | Ensure that 3D Controls is selected.
 | c. | Select ActiveX Controls.
 | d. | Click the Next button.
4. | In the Step 3 of 4 dialog box, do the following:
 | a. | For comments, ensure that Yes, Please is selected.
 | b. | For how to use the MFC library, select Use MFC in a Shared DLL.
 | c. | Click the Next button.
5. | In the Step 4 of 4 dialog box, just click Finish.
6. | Read the New Project Information, and click OK. (The AppWizard creates the project files and opens the project.)
7. | Add #import and #include statements to your program so you can access the LEAD COM constants and classes:
 | a. | In the Project Workspace, click the FileView tab.
 | b. | Double-click the tutor files folder to open it.
 | c. | Double-click the Header Files folder to open it.
 | d. | Double-click the StdAfx.h file to edit it.
8. | Add the following lines to the end of the file (keep in mind, you may have to change the path to where the dll's reside):

#import "c:\\winnt\\system32\\ltrvr14n.dll" no_namespace, named_guids
#import "c:\\winnt\\system32\\ltrtn14n.dll" no_namespace, named_guids
#import "c:\\winnt\system32\\ltrio14n.dll" no_namespace, named_guids

9. | Add an ILEADRasterTwain pointer to the class and set it to NULL in the constructor.
 | a. | In the Project Workspace, click the Class View tab.
 | b. | Select the CTutorDlg class.
 | c. | Right-click and choose "Add Member Variable".
 | d. | For Variable Type enter ILEADRasterTwain.
 | e. | For Variable Declaration enter *m_pRasterTwain.
 | f. | Leave Access as Public.
 | g. | Click the OK button.
 | h. | In the Class View tab, double-click the CTutorDlg constructor function.
 | i. | Add the following line to the end of the constructor:

m_pRasterTwain = NULL;

10. | Go to the Project WorkSpace and click the Resource View tab. Double-click Dialog and double-click IDD_TUTOR_DIALOG to bring up the application's dialog box.
11. | Add the following button:
 | ID | Caption
 | IDC_ACQUIRE | Acquire
12. | Add the following code to the end of OnInitDialog before the return statement:

if (m_pRasterTwain == NULL)
{
CoCreateInstance(CLSID_LEADRasterTwain, NULL, CLSCTX_ALL, IID_ILEADRasterTwain, (void**)&m_pRasterTwain);
}

if (m_pRasterTwain == NULL)
return FALSE;

m_pRasterTwain->InitSession ((long)GetSafeHwnd());
m_pRasterTwain->put_EnableMethodErrors (TRUE);

13. | To end the Twain session and free memory allocated by the COM object, add the following code in the destructor of the CTutorDlg. To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | In the Class name combo box, select CTutorDlg.
 | b. | In the Object IDs list box, select CTutorDlg.
 | c. | In the Messages list box, select WM_DESTROY.
 | d. | Click the Add Function button. Choose OK for the default function name (OnDestroy).
 | e. | Click the Edit Code button to enter the following code before CDialog::OnDestroy().

if (m_pRasterTwain)
{
m_pRasterTwain->EndSession();
}

14. | Add code for the select source button (IDC_ACQUIRE). To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | Click the Message Maps tab.
 | b. | In the Class Name combo box, select CTutorDlg.
 | c. | In the Object IDs list box, select IDC_ACQUIRE.
 | d. | In the Messages list box, select BN_CLICKED.
 | e. | Click the Add Function button. Choose OK for the default function name (OnAcquire).
 | f. | Click the Edit Code button to start entering the code.

void CTutorDlg::OnAcquire()
{
int nRet = 0;
ILEADTwainCapability *pTwainCap;
m_pRasterTwain->SelectSource ();

CoCreateInstance(CLSID_LEADTwainCapability, NULL, CLSCTX_ALL, IID_ILEADTwainCapability, (void**)&pTwainCap);

pTwainCap->CapInfo->Capability = L_CAP_AUTOFEED;
pTwainCap->CapInfo->ConType = L_TWON_ONEVALUE;

BOOL bEnable = TRUE;

ILEADRasterVariant * pRasVar = NULL;
CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL, IID_ILEADRasterVariant, (void**)&pRasVar);

pRasVar->Type
  = VALUE_BOOLEAN;
pRasVar->BooleanValue
  = bEnable;

pTwainCap->CapOneValue->OneValItemType = L_TWTY_BOOL;
pTwainCap->CapOneValue->OneValCapValue = pRasVar;

nRet = m_pRasterTwain->SetCapability2(pTwainCap, L_LTWAIN_CAPABILITY_SET);
if (nRet == 0)
AfxMessageBox(TEXT("AutoFeed capability is enabled"));
else
AfxMessageBox(TEXT("Can't enable AutoFeed capability"));

// try to acquire pages using AutoFeed capability
m_pRasterTwain->Acquire(L_LTWAIN_SHOW_USER_INTERFACE || L_LTWAIN_MODAL_USER_INTERFACE);
}

15.

Compile and test the program.


Twain Feeder: Tutorial # 2 (Visual C++ 5.0)

Take the following steps to start a project:

1. | Start a new project as follows:
 | Run Microsoft Visual C++ 5.0, select the File >New menu option, and do the following:
 | a. | Click the Projects tab.
 | b. | Select MFC AppWizard (exe) as the project type.
 | c. | In the Project name text box, specify tutor.
 | d. | In the Location text box, specify the path of the project.
 | e. | Click the OK button.
2. | In the Step 1 dialog box, do the following:
 | a. | Select Dialog based.
 | b. | Click the Next button.
3. | In the Step 2 of 4 dialog box, do the following:
 | a. | Ensure that About Box is selected.
 | b. | Ensure that 3D Controls is selected.
 | c. | Select ActiveX Controls.
 | d. | Click the Next button.
4. | In the Step 3 of 4 dialog box, do the following:
 | a. | For comments, ensure that Yes, Please is selected.
 | b. | For how to use the MFC library, select Use MFC in a Shared DLL.
 | c. | Click the Next button.
5. | In the Step 4 of 4 dialog box, just click Finish.
6. | Read the New Project Information, and click OK. (The AppWizard creates the project files and opens the project.)
7. | Add #import and #include statements to your program so you can access the LEAD COM constants and classes:
 | a. | In the Project Workspace, click the FileView tab.
 | b. | Double-click the tutor files folder to open it.
 | c. | Double-click the Header Files folder to open it.
 | d. | Double-click the StdAfx.h file to edit it.
8. | Add the following lines to the end of the file (keep in mind, you may have to change the path to where the dll's reside):

#import "c:\\winnt\\system32\\ltrvr14n.dll" no_namespace, named_guids
#import "c:\\winnt\\system32\\ltrtn14n.dll" no_namespace, named_guids
#import "c:\\winnt\system32\\ltrio14n.dll" no_namespace, named_guids

9. | Add an ILEADRasterTwain pointer to the class and set it to NULL in the constructor.
 | a. | In the Project Workspace, click the Class View tab.
 | b. | Select the CTutorDlg class.
 | c. | Right-click and choose "Add Member Variable".
 | d. | For Variable Type enter ILEADRasterTwain.
 | e. | For Variable Declaration enter *m_pRasterTwain.
 | f. | Leave Access as Public.
 | g. | Click the OK button.
 | h. | In the Class View tab, double-click the CTutorDlg constructor function.
 | i. | Add the following line to the end of the constructor:

m_pRasterTwain = NULL;

10. | Go to the Project WorkSpace and click the Resource View tab. Double-click Dialog and double-click IDD_TUTOR_DIALOG to bring up the application's dialog box.
11. | Add the following button:
 | ID | Caption
 | IDC_ACQUIRE | Acquire
12. | Add the following code to the end of OnInitDialog before the return statement:

if (m_pRasterTwain == NULL)
{
CoCreateInstance(CLSID_LEADRasterTwain, NULL, CLSCTX_ALL, IID_ILEADRasterTwain, (void**)&m_pRasterTwain);
}

if (m_pRasterTwain == NULL)
return FALSE;

m_pRasterTwain->InitSession ((long)GetSafeHwnd());
m_pRasterTwain->put_EnableMethodErrors (TRUE);

13. | To end the Twain session and free memory allocated by the COM object, add the following code in the destructor of the CTutorDlg. To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | In the Class name combo box, select CTutorDlg.
 | b. | In the Object IDs list box, select CTutorDlg.
 | c. | In the Messages list box, select WM_DESTROY.
 | d. | Click the Add Function button. Choose OK for the default function name (OnDestroy).
 | e. | Click the Edit Code button to enter the following code before CDialog::OnDestroy().

if (m_pRasterTwain)
{
m_pRasterTwain->EndSession();
}

14. | Add code for the select source button (IDC_ACQUIRE). To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:
 | a. | Click the Message Maps tab.
 | b. | In the Class Name combo box, select CTutorDlg.
 | c. | In the Object IDs list box, select IDC_ACQUIRE.
 | d. | In the Messages list box, select BN_CLICKED.
 | e. | Click the Add Function button. Choose OK for the default function name (OnAcquire).
 | f. | Click the Edit Code button to start entering the code.

void CTutorDlg::OnAcquire()
{
int nRet = 0;
ILEADTwainCapability *pTwainCap;
m_pRasterTwain->SelectSource();

CoCreateInstance(CLSID_LEADTwainCapability, NULL, CLSCTX_ALL, IID_ILEADTwainCapability, (void**)&pTwainCap);

pTwainCap->CapInfo->Capability = L_CAP_FEEDERENABLED;
pTwainCap->CapInfo->ConType = L_TWON_ONEVALUE;

BOOL bEnable = TRUE;

ILEADRasterVariant * pRasVar = NULL;
CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL, IID_ILEADRasterVariant, (void**)&pRasVar);
pRasVar->Type
  = VALUE_BOOLEAN;
pRasVar->BooleanValue
  = bEnable;

pTwainCap->CapOneValue->OneValItemType = L_TWTY_BOOL;
pTwainCap->CapOneValue->OneValCapValue = pRasVar;

nRet = m_pRasterTwain->SetCapability2(pTwainCap, L_LTWAIN_CAPABILITY_SET);
if (nRet == 0)
{
AfxMessageBox(TEXT("CAP_FEEDERENABLED capability is enabled"));

// check if there is document loaded in the feeder
pTwainCap->CapInfo->Capability = L_CAP_DUPLEX;
pTwainCap->CapInfo->ConType = L_TWON_ONEVALUE;

nRet = m_pRasterTwain->GetCapability2 (pTwainCap, L_LTWAIN_CAPABILITY_GETVALUES);
if (nRet == 0)
{
// check if the selected driver supports duplex capability
bEnable = pTwainCap->CapOneValue->OneValCapValue ->BooleanValue;
if (bEnable)
AfxMessageBox(TEXT("There is document loaded in the feeder"));
else
AfxMessageBox(TEXT("There is no document loaded in the feeder"));
}
}
else
AfxMessageBox(TEXT("Can't enable AutoFeed capability"));

// try to acquire pages using CAP_FEEDERENABLED and CAP_FEEDERLOADED capabilities
m_pRasterTwain->Acquire(L_LTWAIN_SHOW_USER_INTERFACE || L_LTWAIN_MODAL_USER_INTERFACE);
}

15.

Compile and test the program.


Miscellaneous Examples (C++ 5.0 and later)

LEADTOOLS Twain COM supports UNICODE. For more information on using the samples in this help file with UNICODE, please refer to A Special Note About UNICODE Support.

You can test any of the following examples by adding a command button to the previous lesson in the tutorial, and pasting the sample code in the Click procedure.

Acquire Example for C++ 5.0 and later

AcquireMulti Example for C++ 5.0 and later

AcquireSourceName Example for C++ 5.0 and later

Capability Example for C++ 5.0 and later

DataTransfer Example for C++ 5.0 and later

Duplex Options Example for C++ 5.0 and later

Effects Example for C++ 5.0 and later

EnableShowUserInterfaceOnly Example for C++ 5.0 and later

EndSession Example for C++ 5.0 and later

EnumCapValue Example for C++ 5.0 and later

FamilyName Example for C++ 5.0 and later

FastConfigEvent Example for C++ 5.0 and later

FindFastConfig Example for C++ 5.0 and later

GetCapability Example for C++ 5.0 and later

GetJPEGCompression Example for C++ 5.0 and later

GetScanConfigs Example for C++ 5.0 and later

Image Frame Options Example for C++ 5.0 and later

Image Options Example for C++ 5.0 and later

ImageEffects Example for C++ 5.0 and later

ImageResolution Example for C++ 5.0 and later

InitSession Example for C++ 5.0 and later

IsAvailable Example for C++5.0 and later

LoadTemplate Example for C++ 5.0 and later

LoadTemplateEvent2 Example for C++ 5.0 and later

Progress Example for C++ 5.0 and later

PtwInfo Example for C++ 5.0 and later

QueryCapability Example for C++ 5.0 and later

QueryFileSystem Example for C++ 5.0 and later

Resolution Example for C++ 5.0 and later

RGB Response Example for C++ 5.0 and later

RightMargin Example for C++ 5.0 and later

SaveTemplate Example for C++ 5.0 and later

SaveTemplateEvent2 Example for C++ 5.0 and later

SelectedFamilyName Example for C++ 5.0 and later

SelectedSourceName Example for C++ 5.0 and later

SelectSource Example for C++ 5.0 and later

SetCapability Example for C++ 5.0 and later

SetJPEGCompression Example for C++ 5.0 and later

ShowTemplateDlg Example for C++ 5.0 and later

SourceName Example for C++ 5.0 and later

StopFeedPages Example for C++ 5.0 and later

Transfer Options Example for C++ 5.0 and later

UnlockSupport Example for C++ 5.0 and later


Acquire Example for C++ 5.0 and later

short iRet;
long lSize;
ILEADRasterTwain *pltRasTwain;
// m_ltRasView is a variable connected to a RasterView control
// created.
CLEADRasterView m_ltRasView;

pltRasTwain->put_FileTransferName (CString("c:\\twain.bmp").AllocSysString());
pltRasTwain->get_MemBufSize(&lSize);
iRet = pltRasTwain-> Acquire(L_LTWAIN_SHOW_USER_INTERFACE);
if (iRet != 0)
MessageBox (TEXT("Error Acquiring From Source"));


AcquireMulti Example for C++ 5.0 and later

void CRasterTwainSink::OnAcquireMultiEvent(short nPage, BSTR bstrFileName, BOOL bFinishScan)
{
CString csMsg;
CString csFileName(bstrFileName);

if (bFinishScan)
{
csMsg.Format(TEXT("The page # %d was scanned and saved to file %s\n"), nPage, csFileName);
AfxMessageBox(csMsg);
}
}

void CTwainView::OnTwainAcquire()
{
short iRet;
long lSize;
ILEADRasterTwain *pltRasTwain;

pltRasTwain->put_FileTransferName (CString("c:\\twain.bmp").AllocSysString());
pltRasTwain->get_MemBufSize(&lSize);
pltRasTwain->put_MemBufSize (lSize * 2);
pltRasTwain->put_EnableAcquireMultiEvent(TRUE);

iRet = pltRasTwain->AcquireMulti("c:\Twain\test.tif", L_LTWAIN_SHOW_USER_INTERFACE, TRUE);
if (iRet != 0)
MessageBox (TEXT("Error acquiring from source"));
}


AcquireSourceName Example for C++ 5.0 and later

ILEADRasterTwain * pltRasTwain;
int SetSourceName (CString Source)
{
pltRasTwain->put_AcquireSourceName(Source.AllocSysString());

short iRet = pltRasTwain->Acquire(L_LTWAIN_SHOW_USER_INTERFACE);
if (iRet != 0)
MessageBox(TEXT("Error acquiring from source"), MB_OK);

return 1;
}


Capability Example for C++ 5.0 and later

ILEADRasterTwain * pltRasTwain;
long lCount;
long lCapability;
ILEADRasterVariant * CapVal = NULL;
CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL,
IID_ILEADRasterVariant, (void **)&CapVal);

ICapability * pCapability = NULL;
ICapabilityOneValue * pCapOV = NULL;

::CoCreateInstance (CLSID_LEADRasterTwainCapability, NULL, CLSCTX_ALL, IID_ICapability, (void **)&pCapability);
pCapability->QueryInterface (IID_ICapabilityOneValue, (void **)&pCapOV);

pltRasTwain->get_ CapsCount (&lCount);
for (long n = 0 ; n < lCount ; n++)
{
pltRasTwain->get_ Capability (n, &lCapability);
// Check for capability and do other processing

if (lCapability == L_ICAP_XFERMECH)
{
pCapability-> EnableMethodErrors = FALSE;
pCapability-> Capability = L_ICAP_XFERMECH;
pCapability-> ConType = L_TWON_ONEVALUE;

CapVal->Type = VALUE_USHORT;
CapVal->LongValue = L_TWSX_FILE;

pCapOV->put_ OneValItemType (L_TWTY_UINT16);
pCapOV->put_ OneValCapValue (CapVal);

pltRasTwain-> SetCapability (pCapability, L_LTWAIN_CAPABILITY_SET);
}
}

CapVal->Release();


DataTransfer Example for C++ 5.0 and later

void TestTwainDataTransfer(HWND hWnd)
{
ILEADRasterTwain * pRasterTwain;

HRESULT hr = ::CoCreateInstance(CLSID_LEADRasterTwain, NULL, CLSCTX_ALL, IID_ILEADRasterTwain, (void **)&pRasterTwain);
if (FAILED(hr) || !pRasterTwain)
{
::MessageBox (NULL, _TEXT("Failed to create a Raster Twain Object"), _TEXT("Error"), MB_OK);
return;
}

pRasterTwain->EnableMethodErrors = FALSE;
pRasterTwain->InitSession((long)hWnd);

pRasterTwain->GetProperties();

pRasterTwain->DataTransfer->FillOrder = L_TWBO_LSBFIRST;
pRasterTwain->DataTransfer->BufferMemoryCompression = L_TWCP_NONE;
pRasterTwain->DataTransfer->TransferMode = L_TWSX_MEMORY;
pRasterTwain->DataTransfer->ScanFileFormat = L_TWFF_BMP;
pRasterTwain->DataTransfer->MemoryBufferSize = 1024;
pRasterTwain->DataTransfer->EnableSaveMultipageFile = FALSE;
pRasterTwain->DataTransfer->EnableAppendToFile = FALSE;
pRasterTwain->DataTransfer->EnableDumpMemoryBuffersToFile = TRUE;
pRasterTwain->FileTransferName = "c:\\test.bmp";

pRasterTwain->SetProperties();
pRasterTwain->EndSession();
}


Duplex Options Example for C++ 5.0 and later

void TestDuplexOptions(ILEADRasterTwain * pRasterTwain)
{
VARIANT_BOOL bEnableDuplex;
short nDuplexMode;
short nMaxXfer;

pRasterTwain->get_EnableDuplex (&bEnableDuplex);
pRasterTwain->get_DuplexMode (&nDuplexMode);
pRasterTwain->get_MaxXferCount (&nMaxXfer);

if (bEnableDuplex != TRUE)
{
pRasterTwain->put_EnableDuplex (TRUE);
pRasterTwain->put_DuplexMode (L_TWDX_1PASSDUPLEX);
}

if (nMaxXfer != 10)
pRasterTwain->put_MaxXferCount (10);
}


Effects Example for C++ 5.0 and later

Image Options Example for C++ 5.0 and later

void TestEffects(ILEADRasterTwain * pRasterTwain)
{
float fContrast, fHighlight;

pRasterTwain->get_ImageContrast (&fContrast);
pRasterTwain->get_ImageHighlight (&fHighlight);

CString csMsg;
csMsg.Format(TEXT("Image Contrst = %d\nImage Highlight = %d\n"), fContrast, fHighlight);
MessageBox(NULL, csMsg, TEXT("Notice!"), MB_OK);

pRasterTwain->put_ImageBrightness (100.0);

pRasterTwain->put_PaperSize(L_TWSS_A4);
pRasterTwain->put_PaperDirection (L_TWOR_LANDSCAPE);
}


EnableShowUserInterfaceOnly Example for C++ 5.0 and later

ILEADRasterTwain * pltRasTwain;
CString strTemplateFile = "";
CFileDialog TemplateFile (FALSE, "ltt", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Template Files (*.ltt)|*.ltt|All Files (*.*)|*.*||");

if (TemplateFile.DoModal() == IDOK)
{
strTemplateFile = TemplateFile.GetPathName();
pltRasTwain-> EnableShowUserInterfaceOnly = TRUE;
short iRet = pltRasTwain->ShowTemplateDlg(strTemplateFile.AllocSysString());
if (iRet != 0)
MessageBox ("Error Showing Template File");
}


EndSession Example for C++ 5.0 and later

ILEADRasterTwain * pltRasTwain;
ICapability * pCapability = NULL;
ICapabilityOneValue * pCapOV = NULL;
ILEADRasterVariant * CapVal = NULL;
CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL,
IID_ILEADRasterVariant, (void **)&CapVal);

::CoCreateInstance (CLSID_LEADRasterTwainCapability, NULL, CLSCTX_ALL, IID_ICapability, (void **)&pCapability);
pCapability->QueryInterface (IID_ICapabilityOneValue, (void **)&pCapOV);

pltRasTwain-> InitSession ((long)m_hWnd);

pCapability-> EnableMethodErrors = FALSE;
pCapability-> Capability = L_ICAP_XFERMECH;
pCapability-> ConType = L_TWON_ONEVALUE;

CapVal->Type = VALUE_USHORT;
CapVal->LongValue = L_TWSX_FILE;

pCapOV->put_ OneValItemType (L_TWTY_UINT16);
pCapOV->put_ OneValCapValue (CapVal);

pltRasTwain-> SetCapability (pCapability, L_LTWAIN_CAPABILITY_SET);

pltRasTwain-> Acquire (L_LTWAIN_SHOW_USER_INTERFACE);
pltRasTwain-> EndSession ();
CapVal->Release ();


EnumCapValue Example for C++ 5.0 and later

// This function will fill a combo box with the values of a certain
// capability either by converting the value to a string or have
// the string value from a previously defined array
// The function will have the ICapability pointer, a handle to the
// combo box, pointer to an array to get strings from, and a variant
// to have the current value

int TwainFillComboBox (ICapability * pCapability, HWND hItem, char szArray[][32], ILEADRasterVariant * *pltRasVar)
{
HRESULT hr;
short iConType;
ValueType vType;

pCapability->get_ ConType (&iConType);

switch (iConType)
{
case L_TWON_ONEVALUE:
{
ICapabilityOneValue * pCapOV = NULL;

hr = pCapability->QueryInterface (IID_ICapabilityOneValue, (void **)&pCapOV);
if (FAILED (hr) || !pCapOV)
return 1;

pCapOV->get_ OneValCapValue (pltRasVar);
vType = (*pltRasVar)->Type;
switch (vType)
{
case VALUE_CHAR:
case VALUE_SHORT:
case VALUE_BYTE:
if (szArray)
{
short index = (*pltRasVar)->ShortValue;
ComboBox_InsertString(hItem, 0, szArray[index]);
}
else
{
char sztext[32];
sprintf(sztext, "%d", (*pltRasVar)->ShortValue);
ComboBox_InsertString(hItem, 0, sztext);
}
ComboBox_SetItemData(hItem, 0, (*pltRasVar)->ShortValue);
break;
case VALUE_LONG:
case VALUE_USHORT:
if (szArray)
{
long index = (*pltRasVar)->LongValue;
ComboBox_InsertString(hItem, 0, szArray[index]);
}
else
{
char sztext[32];
sprintf(sztext, "%d", (*pltRasVar)->LongValue);
ComboBox_InsertString (hItem, 0, sztext);
}
ComboBox_SetItemData (hItem, 0, (*pltRasVar)->LongValue);
break;

case VALUE_ULONG:
if (szArray)
{
ULONG index = (ULONG)(*pltRasVar)->DoubleValue;
ComboBox_InsertString (hItem, 0, szArray[index]);
}
else
{
char sztext[32];
sprintf (sztext, "%d", (*pltRasVar)->DoubleValue);
ComboBox_InsertString (hItem, 0, sztext);
}
ComboBox_SetItemData (hItem, 0, (*pltRasVar)->DoubleValue);
break;
case VALUE_BOOLEAN:
if ((*pltRasVar)->GetBooleanValue())
ComboBox_InsertString (hItem, 0, "TRUE");
else
ComboBox_InsertString (hItem, 0, "FALSE");

ComboBox_SetItemData (hItem, 0, (*pltRasVar)->GetBooleanValue());
break;
case VALUE_FLOAT:
{
char sztext[32];
sprintf (sztext, "%f", (*pltRasVar)->FloatValue);
ComboBox_InsertString (hItem, 0, sztext);
}
break;
default:
pCapOV->Release ();
return 1;
}
ComboBox_SetCurSel (hItem, 0);
pCapOV->Release ();
}
break;
case L_TWON_ENUMERATION:
{
long nCount = 0, nIndex = 0, nCurIndex = 0, nDefIndex = 0;
short iItemType = 0;
ICapabilityEnumeration * pCapEnum = NULL;

hr = pCapability->QueryInterface (IID_ICapabilityEnumeration, (void **)&pCapEnum);
if (FAILED (hr) || !pCapEnum)
return 1;

pCapEnum->get_ EnumNumOfItems (&nCount);
pCapEnum->get_ EnumItemType (&iItemType);
pCapEnum->get_ EnumCurrentIndex (&nCurIndex);
pCapEnum->get_ EnumDefaultIndex (&nDefIndex);
for (nIndex = 0 ; nIndex < nCount ; nIndex ++)
{
pCapEnum->get_ EnumCapValue (nIndex, &(*pltRasVar));
vType = (*pltRasVar)->Type;
switch (vType)
{
case VALUE_CHAR:
case VALUE_SHORT:
case VALUE_BYTE:
if (szArray)
{
short index = (*pltRasVar)->ShortValue;
ComboBox_InsertString(hItem, 0, szArray[index]);
}
else
{
char sztext[32];
sprintf(sztext, "%d", (*pltRasVar)->ShortValue);
ComboBox_InsertString(hItem, 0, sztext);
}
ComboBox_SetItemData(hItem, 0, (*pltRasVar)->ShortValue);
break;
case VALUE_LONG:
case VALUE_USHORT:
if (szArray)
{
long index = (*pltRasVar)->LongValue;
ComboBox_InsertString(hItem, 0, szArray[index]);
}
else
{
char sztext[32];
sprintf(sztext, "%d", (*pltRasVar)->LongValue);
ComboBox_InsertString (hItem, 0, sztext);
}
ComboBox_SetItemData (hItem, 0, (*pltRasVar)->LongValue);
break;

case VALUE_ULONG:
if (szArray)
{
ULONG index = (ULONG)(*pltRasVar)->DoubleValue;
ComboBox_InsertString (hItem, 0, szArray[index]);
}
else
{
char sztext[32];
sprintf (sztext, "%d", (*pltRasVar)->DoubleValue);
ComboBox_InsertString (hItem, 0, sztext);
}
ComboBox_SetItemData (hItem, 0, (*pltRasVar)->DoubleValue);
break;
case VALUE_BOOLEAN:
if ((*pltRasVar)->GetBooleanValue())
ComboBox_InsertString (hItem, 0, "TRUE");
else
ComboBox_InsertString (hItem, 0, "FALSE");

ComboBox_SetItemData (hItem, 0, (*pltRasVar)->GetBooleanValue());
break;
case VALUE_FLOAT:
{
char sztext[32];
sprintf (sztext, "%f", (*pltRasVar)->FloatValue);
ComboBox_InsertString (hItem, 0, sztext);
}
break;
case VALUE_STRING:
{
BSTR bstrVal = (*pltRasVar)->GetStringValue();
CString * pstrText = new CString(bstrVal);
if (pstrText)
{
ComboBox_InsertString (hItem, nIndex, pstrText->GetBuffer(0));
pstrText->ReleaseBuffer();
delete pstrText;
}
}
break;
}
}

ComboBox_SetCurSel (hItem, nCurIndex);
pCapEnum->Release ();
}
break;
case L_TWON_ARRAY:
{
long nCount = 0, nIndex = 0;
short iItemType = 0;
ICapabilityArray * pCapArray = NULL;

hr = pCapability->QueryInterface (IID_ICapabilityArray, (void **)&pCapArray);
if (FAILED (hr) || !pCapArray)
return 1;

pCapArray->get_ ArrayNumOfItems (&nCount);
pCapArray->get_ ArrayItemType (&iItemType);
for (nIndex = 0 ; nIndex < nCount ; nIndex ++)
{
pCapArray->get_ ArrayCapValue (nIndex, &(*pltRasVar));
vType = (*pltRasVar)->Type;
switch (vType)
{
case VALUE_CHAR:
case VALUE_SHORT:
case VALUE_BYTE:
if (szArray)
{
short index = (*pltRasVar)->ShortValue;
ComboBox_InsertString(hItem, 0, szArray[index]);
}
else
{
char sztext[32];
sprintf(sztext, "%d", (*pltRasVar)->ShortValue);
ComboBox_InsertString(hItem, 0, sztext);
}
ComboBox_SetItemData(hItem, 0, (*pltRasVar)->ShortValue);
break;
case VALUE_LONG:
case VALUE_USHORT:
if (szArray)
{
long index = (*pltRasVar)->LongValue;
ComboBox_InsertString(hItem, 0, szArray[index]);
}
else
{
char sztext[32];
sprintf(sztext, "%d", (*pltRasVar)->LongValue);
ComboBox_InsertString (hItem, 0, sztext);
}
ComboBox_SetItemData (hItem, 0, (*pltRasVar)->LongValue);
break;

case VALUE_ULONG:
if (szArray)
{
ULONG index = (ULONG)(*pltRasVar)->DoubleValue;
ComboBox_InsertString (hItem, 0, szArray[index]);
}
else
{
char sztext[32];
sprintf (sztext, "%d", (*pltRasVar)->DoubleValue);
ComboBox_InsertString (hItem, 0, sztext);
}
ComboBox_SetItemData (hItem, 0, (*pltRasVar)->DoubleValue);
break;
case VALUE_BOOLEAN:
if ((*pltRasVar)->GetBooleanValue())
ComboBox_InsertString (hItem, 0, "TRUE");
else
ComboBox_InsertString (hItem, 0, "FALSE");

ComboBox_SetItemData (hItem, 0, (*pltRasVar)->GetBooleanValue());
break;
case VALUE_FLOAT:
{
char sztext[32];
sprintf (sztext, "%f", (*pltRasVar)->FloatValue);
ComboBox_InsertString (hItem, 0, sztext);
}
break;
case VALUE_STRING:
{
BSTR bstrVal = (*pltRasVar)->GetStringValue();
CString * pstrText = new CString(bstrVal);
if (pstrText)
{
ComboBox_InsertString (hItem, nIndex, pstrText->GetBuffer(0));
pstrText->ReleaseBuffer();
delete pstrText;
}
}
break;
}
}

ComboBox_SetCurSel (hItem, 0);
pCapArray->Release ();
}
break;
case L_TWON_RANGE:
{
char sztext[32];
short iItemType;
bool bIncrement = true;
ILEADRasterVariant * pltRasMinVal = NULL;
ILEADRasterVariant * pltRasMaxVal = NULL;
ILEADRasterVariant * pltRasStepVal = NULL;
ILEADRasterVariant * pltRasDefVal = NULL;

long nMinVal, nMaxVal, nStep, nDefVal, nCurVal, nValue, nIndex = 0, nCurIdx = 0;
ICapabilityRange * pCapRange = NULL;

hr = pCapability->QueryInterface (IID_ICapabilityRange, (void **)&pCapRange);
if (FAILED (hr) || !pCapRange)
return 1;

pCapRange->get_ RangeItemType (&iItemType);
pCapRange->get_ RangeMinimumValue (&pltRasMinVal);
pCapRange->get_ RangeMaximumValue (&pltRasMaxVal);
pCapRange->get_ RangeStepSize (&pltRasStepVal);
pCapRange->get_ RangeDefaultValue (&pltRasDefVal);
pCapRange->get_ RangeCurrentValue (pltRasVar);
pCapRange->Release ();

if (pltRasMinVal->Type == VALUE_FLOAT) nMinVal = GetLongValue(pltRasMinVal->FloatValue);
if (pltRasMaxVal->Type == VALUE_FLOAT) nMaxVal = GetLongValue(pltRasMaxVal->FloatValue);
if (pltRasStepVal->Type== VALUE_FLOAT) nStep = GetLongValue(pltRasStepVal->FloatValue);
if (pltRasDefVal->Type == VALUE_FLOAT) nDefVal = GetLongValue(pltRasDefVal->FloatValue);
if ((*pltRasVar)->Type == VALUE_FLOAT) nCurVal = GetLongValue((*pltRasVar)->FloatValue);

for (nValue = nMinVal ; nValue <= nMaxVal ; nValue += nStep)
{
if (nValue == nCurVal)
bIncrement = false;

if (bIncrement)
nCurIdx ++;
sprintf (sztext, "%d", nValue);
ComboBox_InsertString (hItem, nIndex, sztext);
nIndex ++;

if (nMinVal == nMaxVal)
break;
}
ComboBox_SetCurSel (hItem, nCurIdx);

pltRasMinVal->Release();
pltRasMaxVal->Release();
pltRasStepVal->Release();
pltRasDefVal->Release();
}
break;
default:
return 1;
break;
}
return 0;
}

long GetLongValue (float fVal)
{
long lResult;

lResult = (long)fVal;
if (fVal < 0)
{
fVal *= -1;
lResult = (long)fVal;
lResult *= -1;
}

return lResult;
}


FamilyName Example for C++ 5.0 and later

ILEADRasterTwain * pltRasTwain;

CString csBuffer;
long lCount;

pltRasTwain->get_SourceCount (&lCount);
for (long n = 0 ; n < lCount ; n++)
{
csBuffer.Format(TEXT("Source Name = %s\nProduct Family Name = %s\nManufacturer Name = %d\n"),
(TCHAR *)pltRasTwain->GetSourceName(n),
(TCHAR *)pltRasTwain->GetFamilyName(n),
(TCHAR *)pltRasTwain->GetManufacturerName(n));

MessageBox(csBuffer, TEXT("Source Info."));
}


FastConfigEvent Example for C++ 5.0 and later

void CRasterTwainSink::OnFastConfigEvent(ILTFastConfig * pltResConfig)
{
CString csStr;

if (pltResConfig->Success)
{
csStr.Format(TEXT("Transfer Mode = %d\nFile Format = %d\nBuffer Size = %d\nBits Per Pixel = %d\nRequired Time = %d\n"),
pltResConfig->TransferMode,
pltResConfig->FileFormat,
pltResConfig->BufferSize,
pltResConfig->BitsPerPixel,
pltResConfig->RequiredTime);

MessageBox(NULL, csStr, TEXT("Resulting Scan Configurations..."), MB_OK);
}
else
MessageBox(NULL, TEXT("The tested configuration failed..."), TEXT("Error!"), MB_OK);

m_pView->m_pltRasTwain->StopFindFastConfig = FALSE;
}


FindFastConfig Example for C++ 5.0 and later

void CRasterTwainSink::OnFastConfigEvent(ILTFastConfig * pltResConfig)
{
// ... set your code here
.
.
.
.
m_pView->m_pltRasTwain->StopFindFastConfig = FALSE;

}

void CTwainView::OnTwainAcquire()
{
short iRet;
CString csStr;

m_pltRasTwain->EnableFastConfigEvent = TRUE;
m_pltRasTwain->UserFastConfigsCount = 2;

m_pltRasTwain->UserFastConfigs[0]->TransferMode = L_LTWAIN_FILE_MODE;
m_pltRasTwain->UserFastConfigs[0]->FileFormat = FILE_BMP;
m_pltRasTwain->UserFastConfigs[0]->BitsPerPixel = 1;

m_pltRasTwain->UserFastConfigs[1]->TransferMode = L_LTWAIN_FILE_MODE;
m_pltRasTwain->UserFastConfigs[1]->FileFormat = FILE_TIF;
m_pltRasTwain->UserFastConfigs[1]->BitsPerPixel = 1;

iRet = m_pltRasTwain-> FindFastConfig ("c:\\Twain", L_LTWAIN_SHOW_USER_INTERFACE, 1, 1);

if (iRet == 0)
{
MessageBox(TEXT("FindFastConfig method was successful"), TEXT("Notice"), MB_OK);

csStr.Format(TEXT("Resulting Scan Configs count = %d"), m_pltRasTwain->FastConfigsResultCount);
MessageBox(csStr, TEXT("Notice"), MB_OK);

csStr.Empty();
csStr.Format(TEXT("Transfer Mode = %d\nFile Format = %d\nBuffer Size = %d\nRequired Time = %d\n"), m_pltRasTwain->FastConfigsResult[0]->TransferMode, m_pltRasTwain->FastConfigsResult[0]->FileFormat, m_pltRasTwain->FastConfigsResult[0]->BufferSize, m_pltRasTwain->FastConfigsResult[0]->RequiredTime);

MessageBox(csStr, TEXT("Resulting Scan Configurations..."), MB_OK);

csStr.Empty();
csStr.Format(TEXT("Transfer Mode = %d\nFile Format = %d\nBuffer Size = %d\nRequired Time = %d\n"), m_pltRasTwain->BestFastConfig->TransferMode, m_pltRasTwain->BestFastConfig->FileFormat, m_pltRasTwain->BestFastConfig->BufferSize, m_pltRasTwain->BestFastConfig->RequiredTime);

MessageBox(csStr, TEXT("Resulting Scan Configurations..."), MB_OK);
}
else
MessageBox(TEXT("Error occurred in the FindFastConfig method!!!"), TEXT("Error!!!"), MB_OK);
}


GetCapability Example for C++ 5.0 and later

short iRet;
ILEADRasterTwain * pltRasTwain;
ICapability * pICapability;

pICapability->put_ConType (L_TWON_DONTCARE16);
pICapability->put_Capability (L_ICAP_UNITS);

iRet = pltRasTwain->GetCapability (pICapability, L_LTWAIN_CAPABILITY_GETCURRENT);
if (iRet)
{
return iRet;
}


GetJPEGCompression Example for C++ 5.0 and later

void TestGetJPEGCompression(ILEADRasterTwain * pRasterTwain)
{
short nRet = pRasterTwain->GetJPEGCompression(L_LTWAIN_GET_JPEG_COMPRESSION);
if (nRet == 0)
{
CString csJpegData;
csJpegData.Format(TEXT("Color Space = %d\nQuantMap = %d\nGetHuffmanMap = %d\nGetQuantTable Flags = %d\nGetQuantTable Length = %d\nGetQuantTable Data = %d\nGetHuffmanDC Flags = %d\nGetHuffmanDC Data = %d\nGetHuffmanAC Flags = %d\nGetHuffmanAC Data = %d\n"),
pRasterTwain->GetJPEGCompressionData ()->ColorSpace,
pRasterTwain->GetJPEGCompressionData()->GetQuantMap (0),
pRasterTwain->GetJPEGCompressionData()->GetHuffmanMap (0),
pRasterTwain->GetJPEGCompressionData()->GetQuantTable (0)->Flags,
pRasterTwain->GetJPEGCompressionData()->GetQuantTable(0)->Length,
pRasterTwain->GetJPEGCompressionData()->GetQuantTable(0)->Data,
pRasterTwain->GetJPEGCompressionData()->GetHuffmanDC(0)->Flags,
pRasterTwain->GetJPEGCompressionData()->GetHuffmanDC(0)->Data,
pRasterTwain->GetJPEGCompressionData()->GetHuffmanAC(0)->Flags,
pRasterTwain->GetJPEGCompressionData()->GetHuffmanAC(0)->Data);
MessageBox(NULL, csJpegData, TEXT("JPEG Compression Data"), MB_OK);
}
}


GetScanConfigs Example for C++ 5.0 and later

void CTwainView::OnTwainAcquire()
{
short iRet;
CString csStr;

iRet = m_pltRasTwain->GetScanConfigs(1, L_LTWAIN_BUFFER_MODE, 5);
if (iRet == 0)
{
MessageBox(TEXT("GetScanConfigs method was successful"), ("Notice"), MB_OK);

csStr.Format(TEXT("Scan Configuration count = %d") + m_pltRasTwain->ScanConfigCount);
MessageBox(csStr, TEXT("Notice"), MB_OK);

csStr.Format(TEXT("Transfer Mode = %d\nFile Format = %d\nBuffer Size = %d\nRequired Time = %d\n"), m_pltRasTwain->ScanConfig[0]->TransferMode, m_pltRasTwain->ScanConfig[0]->FileFormat, m_pltRasTwain->ScanConfig[0]->BufferSize, m_pltRasTwain->ScanConfig[0]->RequiredTime);

MessageBox(csStr, TEXT("Scan Configurations..."), MB_OK);
}
else
MessageBox(TEXT("Error occurred in GetScanConfigs method!!!"), TEXT("Error!!!"), MB_OK);
}


Image Frame Options Example for C++ 5.0 and later

void TestImageFrameOptions(ILEADRasterTwain * pRasterTwain)
{
ItwFrame * pFrame;
pRasterTwain->get_ImageFrame (&pFrame);

pFrame->LeftMargin = 0;
pFrame->TopMargin = 0;
pFrame->RightMargin = 8.5;
pFrame->BottomMargin = 11;
pRasterTwain->put_ImageFrame (pFrame);
}


Image Options Example for C++ 5.0 and later

Image Frame Options Example for C++ 5.0 and later

void TestImageOptions(ILEADRasterTwain * pRasterTwain)
{
short nUnit, nBPP;

pRasterTwain->get_ImageUnit (&nUnit);
pRasterTwain->get_ImageBitsPerPixel (&nBPP);

if (nUnit != L_TWUN_INCHES)
pRasterTwain->put_ImageUnit (L_TWUN_INCHES);

if (nBPP != 24)
pRasterTwain->put_ImageBitsPerPixel (24);
}


ImageEffects Example for C++ 5.0 and later

void TestTwainImageEfx(HWND hWnd)
{
ILEADRasterTwain * pRasterTwain;

HRESULT hr = ::CoCreateInstance(CLSID_LEADRasterTwain, NULL, CLSCTX_ALL, IID_ILEADRasterTwain, (void **)&pRasterTwain);
if (FAILED(hr) || !pRasterTwain)
{
::MessageBox (NULL, _TEXT("Failed to create a Raster Twain Object"), _TEXT("Error"), MB_OK);
return;
}

pRasterTwain->EnableMethodErrors = FALSE;
pRasterTwain->InitSession((long)hWnd);

pRasterTwain->GetProperties();

pRasterTwain->ImageEffects->PixelFlavor = L_TWPF_VANILLA;
pRasterTwain->ImageEffects->ColorScheme = L_TWPT_BW;
pRasterTwain->ImageEffects->HighLight = 50;
pRasterTwain->ImageEffects->Shadow = 50;
pRasterTwain->ImageEffects->Brightness = 500;
pRasterTwain->ImageEffects->Contrast = 100;

char buf[256];
memset(buf, 0, strlen(buf));
wsprintf(buf, TEXT("Current used Halftone = %d"), pRasterTwain->ImageEffects->HalfTone);
::MessageBox(NULL, buf, "Halftone", MB_OK);

pRasterTwain->SetProperties();
pRasterTwain->EndSession();
}


ImageResolution Example for C++ 5.0 and later

void TestTwainImageRes(HWND hWnd)
{
ILEADRasterTwain * pRasterTwain;

HRESULT hr = ::CoCreateInstance(CLSID_LEADRasterTwain, NULL, CLSCTX_ALL, IID_ILEADRasterTwain, (void **)&pRasterTwain);
if (FAILED(hr) || !pRasterTwain)
{
::MessageBox (NULL, _TEXT("Failed to create a Raster Twain Object"), _TEXT("Error"), MB_OK);
return;
}

pRasterTwain->EnableMethodErrors = FALSE;
pRasterTwain->InitSession((long)hWnd);

pRasterTwain->GetProperties();

pRasterTwain->ImageResolution->Unit = L_TWUN_INCHES;
pRasterTwain->ImageResolution->BitsPerPixel = 1;
pRasterTwain->ImageResolution->HorizontalResolution = 150;
pRasterTwain->ImageResolution->VerticalResolution = 150;
pRasterTwain->ImageResolution->XScaling = 1;
pRasterTwain->ImageResolution->YScaling = 1;
pRasterTwain->ImageResolution->RotationAngle = 90;

pRasterTwain->LeftMargin = 0;
pRasterTwain->RightMargin = 0;
pRasterTwain->TopMargin = 200;
pRasterTwain->BottomMargin = 200;

pRasterTwain->EnableAutoFeed = TRUE;
pRasterTwain->MaxPagesNumber = -1;

char buf[256];

memset(buf, 0, strlen(buf));
wsprintf(buf, TEXT("Duplex state = %d"), pRasterTwain->DuplexScanning);
::MessageBox(NULL, buf, "Duplex", MB_OK);

pRasterTwain->SetProperties();
pRasterTwain->EndSession();
}


InitSession Example for C++ 5.0 and later

ILEADRasterTwain * pltRasTwain;
HWND hWnd;

pltRasTwain->put_ManName (CString("LEAD Technologies, Inc.").AllocSysString ());
pltRasTwain->put_ProdFamily (CString("LEAD Twain COM Object").AllocSysString ());
pltRasTwain->put_Version (CString("Version 14").AllocSysString ());
pltRasTwain->put_AppName (CString("LEADTools Twain test sample").AllocSysString ());

short iRet = pltRasTwain-> InitSession ((long)hWnd);
if (iRet != 0)
MessageBox (TEXT("Error Initializing Twain"));


IsAvailable Example for C++5.0 and later

IsAvailable Example for C++ 5.0 and later

BOOL bRet;
ILEADRasterTwain *pltRasTwain;

::CoCreateInstance(CLSID_LEADRasterTwain, NULL, CLSCTX_ALL, IID_ILEADRasterTwain, void **)&pltRasTwain);

bRet = pltRasTwain->IsAvailable ((long)m_hWnd);
if (bRet)
MessageBox(TEXT("Twain is installed"));
else
MessageBox(TEXT("Twain is not installed"));


LoadTemplate Example for C++ 5.0 and later

ILEADRasterTwain * pltRasTwain;
CString strTemplateFile = TEXT("");
CFileDialog TemplateFile (FALSE, TEXT("ltt"), NULL, OFN_CREATEPROMPT, TEXT("Template Files (*.ltt)|*.ltt|All Files (*.*)|*.*||"));

if (TemplateFile.DoModal() == IDOK)
{
strTemplateFile = TemplateFile.GetPathName();
pltRasTwain->LoadTemplate(strTemplateFile.AllocSysString());
}


LoadTemplateEvent2 Example for C++ 5.0 and later

void CTwainView::OnTestTemplate()
{
m_pltRasTwain->EnableLoadTemplateEvent = TRUE;
m_pltRasTwain->LoadTemplate("c:\\test.ltt");
}

void CRasterTwainSink::OnLoadTemplate2(ILEADTwainCapability * pCapability)
{
// ...
// ...
// set your code here
// ...
}


Progress Example for C++ 5.0 and later

void TestProgress(ILEADRasterTwain * pRasterTwain)
{
pRasterTwain->ShowProgress (TRUE);
}


PtwInfo Example for C++ 5.0 and later

// This sample code is for the AcquirePageEvent handler
// For another
ILEADRasterTwain * pRasTwain;
void CRasterTwainSink::OnAcquire ()
{
ItwExtImageInfo * ptwExt = NULL;
ILEADRasterVariant * Item = NULL;
CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL,
IID_ILEADRasterVariant, (void **)&Item);

::CoCreateInstance (CLSID_twExtImageInfo, NULL, CLSCTX_ALL, IID_ItwExtImageInfo, (void **)ptwExt);
if (ptwExt)
{
ptwExt->put_ NumOfInfos (1);
ptwExt->GetptwInfo(0)->put_ InfoID (L_TWEI_BARCODETEXT);
ptwExt->GetptwInfo(0)->put_ ItemType (L_TWTY_UINT32);

if (!pRasTwain-> GetExtImageInfo (ptwExt))
{
if (ptwExt-> GetptwInfo (0)-> GetCondCode () == L_TWCC_SUCCESS)
{
long lNumOfItems = ptwExt->GetptwInfo(0)-> GetNumOfItems ();
for (int nIndex = 0 ; nIndex < lNumOfItems ; nIndex ++)
{
Item = ptwExt->GetptwInfo(0)-> GetItem (nIndex, 0);
// Do more processing on the item value
}
}
}
ptwExt->Release ();
}

Item->Release ();
}


QueryCapability Example for C++ 5.0 and later

short iRet;
ILEADRasterTwain * pltRasTwain;
ICapability * pICapability;

pICapability->put_ConType (L_TWON_DONTCARE16);
pICapability->put_Capability(L_ICAP_UNITS);

iRet = pltRasTwain->QueryCapability (pICapability);
if (iRet)
{
return iRet;
}


QueryFileSystem Example for C++ 5.0 and later

ILEADRasterTwain *pRasterTwain;
int CTwainView::TestTwainFileSystem()
{
int nRet = pRasterTwain->QueryFileSystem(FILESYSTEM_MSG_AUTOMATICCAPTUREDIRECTORY);
if (nRet != 0)
AfxMessageBox(TEXT("Error occurred during call QueryFileSystem"));

CString csMsg;
csMsg.Format(TEXT("Input Name = %s\nOutput Name = %s\nRecursive = %d\nFileType = %d\n"
"FileSize = %d\nCreateTimeDate = %s\nModifiedTimeDate = %s\nFreeMediaSpace = %d\n"
"NewImageSize = %d\nNumberOfFiles = %d\nNumberOfAudioSnippets = %d\nDeviceGroupMask = %d\n"),
pRasterTwain->FileSystemInfo->InputName,
pRasterTwain->FileSystemInfo->OutputName,
pRasterTwain->FileSystemInfo->Recursive,
pRasterTwain->FileSystemInfo->FileType,
pRasterTwain->FileSystemInfo->FileSize,
pRasterTwain->FileSystemInfo->CreateTimeDate,
pRasterTwain->FileSystemInfo->ModifiedTimeDate,
pRasterTwain->FileSystemInfo->FreeMediaSpace,
pRasterTwain->FileSystemInfo->NewImageSize,
pRasterTwain->FileSystemInfo->NumberOfFiles,
pRasterTwain->FileSystemInfo->NumberOfAudioSnippets,
pRasterTwain->FileSystemInfo->DeviceGroupMask);

AfxMessageBox(csMsg);
return nRet;
}


Resolution Example for C++ 5.0 and later

void TestResoultion(ILEADRasterTwain * pRasterTwain)
{
pRasterTwain->put_XResolution (300.0);
pRasterTwain->put_YResolution (300.0);
}


RGB Response Example for C++ 5.0 and later

void TestRGBResponse(ILEADRasterTwain * pRasterTwain)
{
pRasterTwain->put_RGBElementsCount (2);

pRasterTwain->GetRGBElements(0)->Index = 0;
pRasterTwain->GetRGBElements(0)->Channel1 = 0;
pRasterTwain->GetRGBElements(0)->Channel2 = 0;
pRasterTwain->GetRGBElements(0)->Channel3 = 0;

pRasterTwain->GetRGBElements(1)->Index = 1;
pRasterTwain->GetRGBElements(1)->Channel1 = 255;
pRasterTwain->GetRGBElements(1)->Channel2 = 255;
pRasterTwain->GetRGBElements(1)->Channel3 = 255;

pRasterTwain->SetRGBResponse (L_TWAIN_RGB_RESPONSE_SET, 1);
}


RightMargin Example for C++ 5.0 and later

ILEADRasterTwain * pltRasTwain;
ItwFrame * ptwFrame = NULL;
float m_RightMargin;
float m_LeftMargin;
float m_BottomMargin;
float m_TopMargin;
ILEADRasterVariant * CapVal = NULL;
CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL,
IID_ILEADRasterVariant, (void **)&CapVal);

ICapability * pCapability = NULL;
ICapabilityOneValue * pCapOV = NULL;

::CoCreateInstance (CLSID_twFrame, NULL, CLSCTX_ALL, IID_ItwFrame, (void **)&ptwFrame);
if (ptwFrame)
{
UpdateData (TRUE);

ptwFrame->put_ RightMargin (m_RightMargin);
ptwFrame->put_ LeftMargin (m_LeftMargin);
ptwFrame->put_ TopMargin (m_TopMargin);
ptwFrame->put_ BottomMargin (m_BottomMargin);

::CoCreateInstance (CLSID_LEADRasterTwainCapability, NULL, CLSCTX_ALL, IID_ICapability, (void **)&pCapability);
pCapability->QueryInterface (IID_ICapabilityOneValue, (void **)&pCapOV);

pCapability-> EnableMethodErrors = FALSE;
pCapability-> Capability = L_ICAP_FRAMES;
pCapability-> ConType = L_TWON_ONEVALUE;

CapVal->Type = VALUE_DISPATCH;
CapVal->DispatchValue = ptwFrame;

pCapOV->put_ OneValItemType (L_TWTY_FRAME);
pCapOV->put_ OneValCapValue (CapVal);

pltRasTwain-> SetCapability (pCapability, L_LTWAIN_CAPABILITY_SET);

ptwFrame->Release();
pCapOV->Release();
pCapability->Release();
}

CapVal->Release();


SaveTemplate Example for C++ 5.0 and later

ILEADRasterTwain * pltRasTwain;
CString strTemplateFile = TEXT("");
CFileDialog TemplateFile (FALSE, TEXT("ltt"), NULL, OFN_CREATEPROMPT, TEXT("Template Files (*.ltt)|*.ltt|All Files (*.*)|*.*||"));

if (TemplateFile.DoModal() == IDOK)
{
strTemplateFile = TemplateFile.GetPathName();
pltRasTwain->SaveTemplate (strTemplateFile.AllocSysString());
}


SaveTemplateEvent2 Example for C++ 5.0 and later

void CTwainView::OnTestTemplate()
{
m_pltRasTwain->EnableSaveTemplateEvent = TRUE;
m_pltRasTwain->SaveTemplate("c:\\test.ltt");
}

void CRasterTwainSink::OnSaveTemplate2(ILEADTwainCapability * pCapability)
{
// ...
// ...
// set your code here
// ...
}


SelectedFamilyName Example for C++ 5.0 and later

ILEADRasterTwain * pltRasTwain;
CString csBuffer;

csBuffer.Format(TEXT("Source Name = %s\nProduct Family Name = %s\nManufacturer Name = %d\n"),
(TCHAR *)pltRasTwain->GetSelectedSourceName(),
(TCHAR *)pltRasTwain->GetSelectedFamilyName(),
(TCHAR *)pltRasTwain->GetSelectedManufacturerName());

MessageBox(csBuffer, TEXT("Selected Source Info."));


SelectedSourceName Example for C++ 5.0 and later

ILEADRasterTwain * pltRasTwain;

CString csBuffer;

csBuffer.Format(TEXT("The current selected source is: %s"), (TCHAR *)pltRasTwain->GetSelectedSourceName());
MessageBox(csBuffer, TEXT("Selected Source Name"));


SelectSource Example for C++ 5.0 and later

ILEADRasterTwain * pltRasTwain;

pltRasTwain->SelectSource ();


SetCapability Example for C++ 5.0 and later

ILEADRasterTwain * m_pltRasTwain;
void TestSetCapability()
{
short iRet;
HRESULT hr;
ICapability * pCapability = NULL;
ICapabilityOneValue * pCapOV = NULL;

hr = ::CoCreateInstance (CLSID_LEADRasterTwainCapability, NULL, CLSCTX_ALL, IID_ICapability, (void **)&pCapability);
if (FAILED (hr) || pCapability == NULL)
return;

pCapability->put_ EnableMethodErrors (VARIANT_FALSE);

pCapability-> ConType = L_TWON_DONTCARE16;
pCapability-> Capability = L_ICAP_UNITS;
iRet = m_pltRasTwain-> GetCapability (pCapability, L_LTWAIN_CAPABILITY_GETCURRENT);

if (iRet != 0)
MessageBox(NULL, TEXT("Error Getting Capability"), NULL, MB_OK);

pCapability->QueryInterface (IID_ICapabilityOneValue, (void **)&pCapOV);
if (!pCapOV)
{
pCapability->Release ();
return;
}

pCapability->put_ Capability (L_ICAP_UNITS);
pCapability->put_ ConType (L_TWON_ONEVALUE);

ILEADRasterVariant * CapVal = NULL;
CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL,
IID_ILEADRasterVariant, (void **)&CapVal);

CapVal->Type = VALUE_USHORT;
CapVal->LongValue = L_TWUN_INCHES;

pCapOV->put_ OneValItemType (L_TWTY_UINT16);
pCapOV->put_ OneValCapValue (CapVal);

iRet = m_pltRasTwain-> SetCapability (pCapability, L_LTWAIN_CAPABILITY_SET);

pCapOV->Release ();
pCapability->Release ();
CapVal->Release();

}


SetJPEGCompression Example for C++ 5.0 and later

void TestJPEGCompression(ILEADRasterTwain * pRasterTwain)
{
short nRet = pRasterTwain->GetJPEGCompression(L_LTWAIN_GET_JPEG_COMPRESSION);
if (nRet == 0)
{
pRasterTwain->GetJPEGCompressionData ()->ColorSpace = L_TWPT_GRAY;
pRasterTwain->GetJPEGCompressionData()->SubSampling = 0x10001000;
pRasterTwain->GetJPEGCompressionData()->NumComponents = 1;
pRasterTwain->GetJPEGCompressionData()->RestartFrequency = 0;
pRasterTwain->GetJPEGCompressionData()->PutQuantMap(0, 0);
pRasterTwain->GetJPEGCompressionData()->PutHuffmanMap(0, 0);

nRet = pRasterTwain->SetJPEGCompression(L_LTWAIN_SET_JPEG_COMPRESSION);
if (nRet == 0)
MessageBox(NULL, TEXT("Set JPEG compression options is success"), ("Notice!"), MB_OK);
}
}


ShowTemplateDlg Example for C++ 5.0 and later

ILEADRasterTwain * pltRasTwain;
CString strTemplateFile = TEXT("");
CFileDialog TemplateFile (FALSE, TEXT("ltt"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, TEXT("Template Files (*.ltt)|*.ltt|All Files (*.*)|*.*||"));

if (TemplateFile.DoModal() == IDOK)
{
strTemplateFile = TemplateFile.GetPathName();
short iRet = pltRasTwain->ShowTemplateDlg(strTemplateFile.AllocSysString());
if (iRet != 0)
MessageBox (TEXT("Error Showing Template File"));
}


SourceName Example for C++ 5.0 and later

ILEADRasterTwain * pltRasTwain;
BSTR strName;
long lCount;

pltRasTwain->get_SourceCount (&lCount);
for (long n = 0 ; n < lCount ; n++)
{
pltRasTwain->get_SourceName (n, &strName);
// Check for source name and do other processing
}


StopFeedPages Example for C++ 5.0 and later

void CTwainView::OnTwainAcquire()
{
short iRet;

m_ltRasView.SetAutoRepaint(VARIANT_TRUE);
m_ltRasView.SetBackErase(VARIANT_FALSE);
m_ltRasView.GetRaster().SetBitmapList (0);

// select ADF option from the user interface
iRet = m_pltRasTwain->Acquire (L_LTWAIN_SHOW_USER_INTERFACE);
if (iRet != 0)
MessageBox (TEXT("Error acquiring from source"));
}

void CRasterTwainSink::OnAcquire (long pBitmap)
{
m_pView->m_ltRasView.GetRaster().InsertBitmapListItem (-1, pBitmap);
m_pView->m_pltRasTwain->StopFeedPages = FALSE;
}


Transfer Options Example for C++ 5.0 and later

void TestTransferOptions(ILEADRasterTwain * pRasterTwain)
{
pRasterTwain->GetTransferOptions ();

pRasterTwain->put_TransferMode (L_TWAIN_TRANSFER_FILE);

CString csFileName = TEXT("c:\\test.bmp");
pRasterTwain->put_TransferFileName (csFileName.AllocSysString());
pRasterTwain->put_TransferFileFormat (L_TWFF_BMP);
pRasterTwain->put_TransferCompressionType (L_TWCP_NONE);

pRasterTwain->SetTransferOptions ();

if (pRasterTwain->IsFileTransferAvailable)
MessageBox(NULL, TEXT("File transfer is supported"), TEXT("Notice!"), MB_OK);
if (pRasterTwain->IsMemoryTransferAvailable)
MessageBox(NULL, TEXT("Memory transfer is supported"), TEXT("Notice!"), MB_OK);
if (pRasterTwain->IsNativeTransferAvailable)
MessageBox(NULL, TEXT("Native transfer is supported"), TEXT("Notice!"), MB_OK);
}


UnlockSupport Example for C++ 5.0 and later

if (pltRasTwain->IsSupportLocked(L_SUPPORT_DOCUMENT))
pltRasTwain->UnlockSupport(L_SUPPORT_DOCUMENT, "TestKey");


Tutorial for Delphi 4.0 Programmers

The following topics provide brief and simple examples to help you learn how to use the LEAD RasterTwain Object Library.

LEADTOOLS Twain COM supports UNICODE. For more information on using the samples in this help file with UNICODE, please refer to A Special Note About UNICODE Support.

Note:

These tutorial examples are intended to be easy to understand and easy to test. The example programs in the EXAMPLES subdirectory provide more in depth design and more detailed code.

Acquiring an Image

Using the Fast TWAIN Feature

Get a Fast Twain Scan from a Scanner

Set/Get a Twain Capability


Acquiring an Image (Delphi 4.0)

Take the following steps to start a project and to add some code that acquires an image from a TWAIN source:

1. | Start Delphi 4.0.
2. | If you didn’t install LEAD RasterView Control, install it as follows:
 | On the Component pull-down menu, use the Import ActiveX Control… and select the LEAD RasterView Control (14). Press install, and then compile and install the package dclusr40.dpk.
3. | Select the LEAD RasterView control and add it to Form1. Size and position the control as you want it to appear at run time.
4. | On the Project pull-down menu, use the Import Type library… and select the LEAD RasterTwain Object Library (14). Press OK.
5. | If you didn’t import LEAD Raster Variant before, import it as follows:
6. | On the Project pull-down menu, use the Import Type library… and select the LEAD Raster Variant Object Library (14). Press install, and then compile and install the package dclusr40.dpk.
7. | If you didn’t install LEADEventSink Control, install it as follows:
 | On the Component pull-down menu, use Install component …, and browse to LEADXX\Include\LEvntSnk.pas. Press OK, and then compile and install the package dclusr40.dpk.
8. | From the ActiveX controls, add the LEADEventSink control to Form1.
9. | Add the following code to the private section of Unit1:

TwainCap: LEADTwainCapability;
RasterTwain: LEADRasterTwain;
nXferMode: Integer;
nRet: Integer;
Function TwainSetCapability ( uCapability: Integer; CapVal: LEADRasterVariant; uItemType: Integer): Integer;

10.

Handle the Form1 OnCreate event, and code the FormCreate procedure as follows:

procedure TForm1.FormCreate(Sender: TObject);
begin
TwainCap:= CreateComObject ( CLASS_LEADTwainCapability ) as LEADTwainCapability;

RasterTwain:= CreateComObject ( CLASS_LEADRasterTwain ) as LEADRasterTwain;
RasterTwain.InitSession ( Handle ) ;
LEADEventSink1.Connect ( RasterTwain, _LEADRasterTwainEvents );
end;

11.

Handle the Form1 OnClose event, and code the FormClose procedure as follows:

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
RasterTwain.EndSession();
end;

12. | At the top of Form1, add six Buttons and three Option Buttons and name them as follows:
 | Name | Caption
 | btnOK | OK
 | btnCancel | Cancel
 | btnAcquire | Acquire
 | btnSelectSource | Select Source
 | btnNative | Native
 | btnMemBuf | Memory Buffered
 | btnFile | File
 | btnSaveTemplate | Save Template File
 | btnLoadTemplate | Load Template File
13. | Handle the btnOK OnClick event, and code the btnOKClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

procedure TForm1.btnOKClick(Sender: TObject);
begin
Close ( ) ;
end;

14.

Handle the btnCancel OnClick event, and code the btnCancelClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code:

procedure TForm1.btnCancelClick(Sender: TObject);
begin
Close ( ) ;
end;

15.

Handle the btnAcquire OnClick event, and code the btnAcquireClick procedure as follows:

procedure TForm1.btnAcquireClick(Sender: TObject);
begin
RasterTwain.Acquire ( L_LTWAIN_SHOW_USER_INTERFACE ) ;
end;

16.

Handle the btnSelectSource OnClick event, and code the btnSelectSourceClick procedure as follows:

procedure TForm1.btnSelectSourceClick(Sender: TObject);
begin
RasterTwain.SelectSource ( ) ;
end;

17.

Handle the btnSaveTemplate OnClick event, and code the btnSaveTemplateClick procedure as follows:

procedure TForm1.btnSaveTemplateClick(Sender: TObject);
begin
nRet:= RasterTwain.SaveTemplate ('c:\test.ltt');
end;

18.

Handle the btnLoadTemplate OnClick event, and code the btnLoadTemplateClick procedure as follows:

procedure TForm1.btnLoadTemplateClick(Sender: TObject);
begin
nRet:= RasterTwain.LoadTemplate ( 'c:\test.ltt' ) ;
end;

19.

Handle the btnNative option button’s OnClick event, and code the btnNativeClick procedure as Follows:

procedure TForm1.btnNativeClick(Sender: TObject);
var
CapVal: LEADRasterVariant;
begin
nXferMode:= L_TWSX_NATIVE;
CapVal:= coLEADRasterVariant.Create ( );
CapVal.Type_:= VALUE_USHORT;
CapVal.LongValue:= nXferMode;
TwainSetCapability ( L_ICAP_XFERMECH, CapVal, L_TWTY_UINT16 );
end;

20.

Handle the btnMemBuf option button’s OnClick event, and code the btnMemBufClick procedure as follows:

procedure TForm1.btnMemBufClick(Sender: TObject);
var
CapVal: LEADRasterVariant;
begin
nXferMode:= L_TWSX_MEMORY;
CapVal:= coLEADRasterVariant.Create ( );
CapVal.Type_:= VALUE_USHORT;
CapVal.LongValue:= nXferMode;
TwainSetCapability ( L_ICAP_XFERMECH, CapVal, L_TWTY_UINT16 );
end;

21.

Handle the btnFile option button’s OnClick event, and code the btnFileClick procedure as follows:

procedure TForm1.btnFileClick(Sender: TObject);
var
CapVal: LEADRasterVariant;
begin
nXferMode:= L_TWSX_FILE;
CapVal:= coLEADRasterVariant.Create ( );
CapVal.Type_:= VALUE_USHORT;
CapVal.LongValue:= nXferMode;
TwainSetCapability ( L_ICAP_XFERMECH, CapVal, L_TWTY_UINT16 );
RasterTwain. FileTransferName := 'c:\twain.bmp';
end;

22.

Handle the LEADEventSink1 OnInvoke event, and code the LEADEventSink1Invoke procedure as follows:

procedure TForm1.LEADEventSink1Invoke(Sender: TObject; DispID: Integer;
const IID: TGUID; LocaleID: Integer; Flags: Word; Params: tagDISPPARAMS;
varResult, ExcepInfo, ArgErr: Pointer);
var
pBitmap: Integer;
begin
Case (DispID) of
LEADRASTER_TWAIN_EVENTS_ACQUIREPAGEEVENT:
begin
pBitmap:= OleVariant ( Params.rgvarg[0] ) ;
ShowMessage ( 'Acquisition of Image Done' ) ;
LEADRasterView1.Raster.InsertBitmapListItem ( -1, pBitmap ) ;
end;
end;
end;

23.

Add the TwainSetCapability function body to the Unit1 file.

Function TForm1.TwainSetCapability ( uCapability: Integer; CapVal: LEADRasterVariant; uItemType: Integer): Integer;
var
iRet: Integer;
begin
TwainCap.EnableMethodErrors:= False;
TwainCap.CapInfo.Capability:= uCapability;
TwainCap.CapInfo.ConType:= L_TWON_ONEVALUE;
TwainCap.CapOneValue.OneValItemType:= uItemType;
TwainCap.CapOneValue.OneValCapValue:= CapVal;

iRet:= RasterTwain.SetCapability2(TwainCap, L_LTWAIN_CAPABILITY_SET);
TwainSetCapability:= iRet;
end;

24. | At the beginning of the Unit1 file, add ComObj, LTRASTERVARIANTLib_TLB, LTRASTERTWAINLib_TLB, ActiveX to the uses section. This lets you handle the Com objects, the Raster Twain object library, and use ActiveX Controls.
25. | Run your program to test it.


Using the Fast TWAIN Feature (Delphi 4.0)

Take the following steps to start a project and to add some code that acquires the images using Fast Twain:

1. | Start Delphi 4.0.
2. | On the Project pull-down menu, use Import Type library… and select the LEAD RasterTwain Object Library (14). Press OK.
3. | Add the following code to the private section of Unit1:

TwainCap: LEADTwainCapability;
RasterTwain: LEADRasterTwain;
nRet: Integer;

4.

Handle the Form1 OnCreate event, and code the FormCreate procedure as follows:

procedure TForm1.FormCreate(Sender: TObject);
begin
TwainCap:= CreateComObject ( CLASS_LEADTwainCapability ) as LEADTwainCapability;
RasterTwain:= CreateComObject ( CLASS_LEADRasterTwain) as LEADRasterTwain;
RasterTwain.UnlockSupport ( L_SUPPORT_DOCUMENT, 'TestKey' ) ;
RasterTwain.InitSession ( Handle ) ;
RasterTwain.EnableMethodErrors:= False;
rbMemory.Checked:= True;
end;

5.

Handle the Form1 OnClose event, and code the FormClose procedure as follows:

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
RasterTwain.EndSession ( ) ;
end;

6. | At the top of Form1, add a check box and name it as follows:
 | Name | Caption
 | chkUseBufferSize | Use Buffer Size
7. | Add 2 radio buttons, and name them as follows:
 | Name | Caption
 | rbNative | Native Mode
 | rbMemory | Memory Mode
8. | Add 1 button, and name it as follows:
 | Name | Caption
 | btnAcquire | Fast Acquire
9. | Add 2 Edit boxes, and name them as follows:

edtBufferSize
edtFName

10.

Handle the btnAcquire control's OnClick event, and code the btnAcquireClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

procedure TForm1.btnAcquireClick(Sender: TObject);
begin
if ( rbMemory.Checked = True ) then
begin
RasterTwain.FastTransferMode:= L_LTWAIN_BUFFER_MODE ;
RasterTwain.FastFormat:= FILE_CCITT_GROUP4 ;
end
else
begin
RasterTwain.FastTransferMode:= L_LTWAIN_NATIVE_MODE ;
RasterTwain.FastFormat:= FILE_TIF;
end;

RasterTwain.FastBitsPerPixel:= 1;
RasterTwain.FastUsePreferredBufferSize:= chkUseBufferSize.Checked;
if ( RasterTwain.FastUsePreferredBufferSize ) then
RasterTwain.FastBufferSize:= StrToInt(edtBufferSize.Text);

nRet:= RasterTwain.AcquireMulti (edtFName.Text, L_LTWAIN_SHOW_USER_INTERFACE Or L_LTWAIN_USE_THREAD_MODE, True);
if ( nRet = 0 ) then
ShowMessage ( 'Fast Scanning process done successfully...' )
else
ShowMessage ( 'AcquireMulti failed, Error = ' + IntToStr ( nRet ) ) ;
end;

11. | At the beginning of the Unit1 file, add ComObj, LTRASTERTWAINLib_TLB, LTDLLDef, ActiveX to the uses section. This lets you handle the Com objects, the Raster Twain object library, use the LEAD Defines in Delphi, and use the ActiveX Controls.
12. | Save your project and run your program to test it.


Get a Fast Twain Scan from a Scanner (Delphi 4.0)

Take the following steps to start a project and to add some code to find the fastest configuration for your scanner using the LEADTOOLS Fast TWAIN feature:

1. | Start Delphi 4.0.
2. | On the Project pull-down menu, use the Import Type library… and select the LEAD Raster Object Library (14). Press OK.
3. | On the Project pull-down menu, use the Import Type library… and select the LEAD RasterTwain Object Library (14). Press OK.
4. | Declare the following variables in the public section of Unit1:

RasterTwain: LEADRasterTwain;
nRet: Integer;

5.

Handle the Form1 OnCreate event, and code the FormCreate procedure as follows:

procedure TForm1.FormCreate(Sender: TObject);
begin
RasterTwain:= CreateComObject ( CLASS_LEADRasterTwain ) as LEADRasterTwain;
RasterTwain.InitSession ( Handle ) ;
RasterTwain.EnableMethodErrors:= False;

{ Unlock Document support.
Note that this is a sample key, which will not work in your toolkit. }
RasterTwain.UnlockSupport ( L_SUPPORT_DOCUMENT, 'TestKey' ) ;

end;

6.

Handle the Form1 OnClose event, and code the FormClose procedure as follows:

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
RasterTwain.EndSession ( ) ;
RasterTwain:= Nil;
end;

7. | At the top of Form1, add 3 button controls and name them as follows:
 | Name | Caption
 | btnSelectSource | Select Source
 | btnFindFastConfig | Find Fast Config.
 | btnAcquireFastConfig | Acquire Fast Config.
8. | Handle the btnSelectSource OnClick event, and code the btnSelectSourceClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

procedure TForm1.btnSelectSourceClick(Sender: TObject);
begin
RasterTwain.SelectSource ( ) ;
end;

9.

Handle the btnFindFastConfig OnClick event, and code btnFindFastConfigClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

procedure TForm1.btnFindFastConfigClick(Sender: TObject);
begin
RasterTwain.UserFastConfigsCount := 0;
RasterTwain.EnableFastConfigEvent := False;
nRet:= RasterTwain.FindFastConfig ('c:\temp', L_LTWAIN_SHOW_USER_INTERFACE Or L_LTWAIN_USE_THREAD_MODE, 8, 5);

if ( nRet = 0 ) Then
ShowMessage ('Find Fast Configuration process completed' )
else
ShowMessage ('An error occurred during the Finding Fast Configuration process.' ) ;

end;

10.

Handle the btnAcquireFastConfig OnClick event, and code the btnAcquireFastConfigClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

procedure TForm1.btnAcquireFastConfigClick(Sender: TObject);
begin
RasterTwain.FastTransferMode := RasterTwain.BestFastConfig.TransferMode;
RasterTwain.FastFormat := RasterTwain.BestFastConfig.FileFormat;
RasterTwain.FastBitsPerPixel := RasterTwain.BestFastConfig.BitsPerPixel;
RasterTwain.FastBufferSize := RasterTwain.BestFastConfig.BufferSize;

RasterTwain.FastUsePreferredBufferSize := True;
RasterTwain.EnableAcquireMultiEvent := False;

nRet := RasterTwain.AcquireMulti ('c:\temp\test', L_LTWAIN_SHOW_USER_INTERFACE, True);

if ( nRet = 0 ) Then
ShowMessage ( 'Image acquisition using the Fast TWAIN Configuration is completed' )
else
ShowMessage ( 'An error occurred while acquiring images using the Fast TWAIN Configuration' ) ;
end;

11. | At the beginning of the Unit1 file, add ComObj, LTRASTERTWAINLib_TLB, LTDLLDef to the uses section. This lets you handle the Com objects, the Raster Twain object library, and use the LEAD Defines.
12. | Save your project and run your program to test it.


Set/Get a Twain Capability (Delphi 4.0)

Take the following steps to start a project and to add some code to use the Get/Set capability methods and then acquire your image using the newly set capability:

1. | Start Delphi.
2. | On the Project pull-down menu, use the Import Type library… and select the LEAD Raster Object Library (14). Press OK.
3. | On the Project pull-down menu, use the Import Type library… and select the LEAD RasterTwain Object Library (14). Press OK.
4. | If you didn’t import LEAD Raster Variant before, import it as follows:
5. | On the Project pull-down menu, use the Import Type library… and select the LEAD Raster Variant Object Library (14). Press install, and then compile and install the package dclusr40.dpk.
6. | Declare the following variables in the public section of Unit1:

TwainCap1: LEADTwainCapability;
TwainCap2: LEADTwainCapability;
TwainCap3: LEADTwainCapability;
RasterTwain: LEADRasterTwain;
nRet: Integer;

7.

Handle the Form1 OnCreate event, and code the FormCreate procedure as follows:

procedure TForm1.FormCreate(Sender: TObject);
begin
RasterTwain:= coLEADRasterTwain.Create ( );
TwainCap1:= coLEADTwainCapability.Create ( );
TwainCap2:= coLEADTwainCapability.Create ( );
TwainCap3:= coLEADTwainCapability.Create ( );

RasterTwain.InitSession ( Handle ) ;
RasterTwain. EnableMethodErrors := False;

{ Unlock Document support.
Note that this is a sample key, which will not work in your toolkit. }
RasterTwain. UnlockSupport ( L_SUPPORT_DOCUMENT, 'TestKey' ) ;
end;

8.

Handle the Form1 OnClose event, and code the FormClose procedure as follows:

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
RasterTwain.EndSession ( ) ;
RasterTwain:= Nil;
end;

9. | At the top of Form1, add 4 button controls and name them as follows:
 | Name | Caption
 | btnSelectSource | Select Source
 | btnUseCapability | Use Capability
 | btnSetBrightness | Set Brightness
 | btnAcquire | Acquire
10. | Handle the btnSelectSource OnClick event, and code the btnSelectSourceClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

procedure TForm1.btnSelectSourceClick(Sender: TObject);
begin
RasterTwain.SelectSource ( ) ;
end;

11.

Handle the btnUseCapability OnClick event, and code the btnUseCapabilityClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

procedure TForm1.btnUseCapabilityClick(Sender: TObject);
var
Xfer: LEADRasterVariant;
begin
TwainCap1. EnableMethodErrors := False;
TwainCap1.CapInfo. ConType := L_TWON_ONEVALUE;
TwainCap1.CapInfo. Capability := L_ICAP_XFERMECH;

nRet:= RasterTwain. GetCapability2 ( TwainCap1, L_LTWAIN_CAPABILITY_GETCURRENT ) ;
if ( nRet = 0 ) then
begin
Xfer:= TwainCap1.CapOneValue. OneValCapValue ;
if ( Xfer.LongValue <> L_TWSX_FILE ) then
begin
TwainCap2. EnableMethodErrors := False;
TwainCap2.CapInfo. Capability := L_ICAP_XFERMECH;
TwainCap2.CapInfo. ConType := L_TWON_ONEVALUE;

TwainCap2.CapOneValue. OneValItemType := L_TWTY_UINT16;
TwainCap2.CapOneValue. OneValCapValue := Xfer;

nRet:= RasterTwain. SetCapability2 ( TwainCap2, L_LTWAIN_CAPABILITY_SET );
end
else
ShowMessage ( 'The Transfer mode is File' ) ;
end
else
ShowMessage ( 'Error occurred in GetCapability method' ) ;
end;

12.

Handle the btnSetBrightness OnClick event, and code the btnSetBrightnessClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

procedure TForm1.btnSetBrightnessClick(Sender: TObject);
var
iRet: Integer;
CapVal: LEADRasterVariant;
begin
TwainCap3.CapInfo. ConType := L_TWON_ONEVALUE;
TwainCap3.CapInfo. Capability := L_ICAP_BRIGHTNESS;
TwainCap3. EnableMethodErrors := False;

CapVal:= coLEADRasterVariant.Create ( );
CapVal.type_:= VALUE_USHORT;
CapVal.LongValue:= 50;

TwainCap3.CapOneValue. OneValItemType := L_TWTY_FIX32;
TwainCap3.CapOneValue. OneValCapValue := CapVal;

iRet:= RasterTwain. SetCapability2 (TwainCap3, L_LTWAIN_CAPABILITY_SET);
if (iRet <> 0) then
ShowMessage ( 'Error Setting Capability' );
end;

13.

Handle the btnAcquire OnClick event, and code the btnAcquireClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

procedure TForm1.btnAcquireClick(Sender: TObject);
begin
RasterTwain.FileTransferName:= 'c:\twain.bmp';
nRet:= RasterTwain.Acquire ( L_LTWAIN_SHOW_USER_INTERFACE ) ;
if ( nRet <> 0 ) then
ShowMessage ( 'Error acquiring from source' ) ;
end;

14. | At the beginning of the Unit1 file, add ComObj, LTRASTERTWAINLib_TLB, LTRASTERVARIANTLib_TLB, LTDLLDef to the uses section. This lets you handle the Com objects, the Raster Twain object library, and use the LEAD Defines.
15. | Save your project and run your program to test it.


Tutorial for Delphi 6.0 Programmers

The following topics provide brief and simple examples to help you learn how to use the LEAD RasterTwain Object Library.

For general information about the syntax requirements of this interface, refer to Visual C++ 5.0 Syntax .

LEADTOOLS Twain COM supports UNICODE. For more information on using the samples in this help file with UNICODE, please refer to A Special Note About UNICODE Support.

Note:

These tutorial examples are intended to be easy to understand and easy to test. The example programs in the EXAMPLES subdirectory provide more in depth design and more detailed code.

Acquiring an Image

Using the Fast TWAIN Feature

Get a Fast Twain Scan from a Scanner

Set/Get a Twain Capability


Acquiring an Image (Delphi 6.0)

Take the following steps to start a project and to add some code that acquires an image from a TWAIN source:

1. | Start Delphi 6.0.
2. | If you didn’t install LEAD RasterView Control, install it as follows:
 | On the Component pull-down menu, use Import ActiveX Control… and select the LEAD RasterView Control (14). Press install, and then compile and install the package dclusr.dpk.
3. | Select the LEAD RasterView control and add it to your form. Size and position the control, as you want it to appear at run time.
4. | If you didn’t import LEAD Raster Twain before, import it as follows:
 | On the Project pull-down menu, use Import Type library… and select the LEAD RasterTwain Object Library (14). Press install, and then compile and install the package dclusr.dpk.
5. | From the ActiveX controls tab, add the LEAD Raster Twain control and the LEAD Twain Capability control to your form.
6. | If you didn’t import LEAD Raster Variant before, import it as follows:
7. | On the Project pull-down menu, use the Import Type library… and select the LEAD Raster Variant Object Library (14). Press install, and then compile and install the package dclusr.dpk.
8. | From the ActiveX controls tab, add the LEAD Raster Variant control to your form.
9. | At the top of your form, add 9 Buttons and name them as follows:
 | Name | Caption
 | btnOK | OK
 | btnCancel | Cancel
 | btnAcquire | Acquire
 | btnSelectSource | Select Source
 | btnSaveTemplate | Save Template File
 | btnLoadTemplate | Load Template File
 | btnNative | Native
 | btnMemBuf | Memory Buffered
 | btnFile | File
10. | Add the following code to the private section of Unit1:

nXferMode: Integer;
nRet: Integer;
Function TwainSetCapability ( uCapability: Integer;
CapVal: LEADRasterVariant;
uItemType: Integer ): Integer;

11.

Handle the Form1 OnCreate event, and code the FormCreate procedure as follows:

procedure TForm1.FormCreate(Sender: TObject);
begin
LEADRasterTwain1.InitSession ( Handle ) ;
end;

12.

Handle the Form1 OnClose event, and code the FormClose procedure as follows:

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
LEADRasterTwain1.EndSession ();
end;

13.

Handle the btnOK OnClick event, and code the btnOKClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

procedure TForm1.btnOKClick(Sender: TObject);
begin
Close ( ) ;
end;

14.

Handle the btnCancel OnClick event, and code the btnCancelClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code:

procedure TForm1.btnCancelClick(Sender: TObject);
begin
Close ( ) ;
end;

15.

Handle the btnAcquire OnClick event, and code the btnAcquireClick procedure as follows:

procedure TForm1.btnAcquireClick(Sender: TObject);
begin
LEADRasterTwain1.Acquire ( L_LTWAIN_SHOW_USER_INTERFACE ) ;
end;

16.

Handle the btnSelectSource OnClick event, and code the btnSelectSourceClick procedure as follows:

procedure TForm1.btnSelectSourceClick(Sender: TObject);
begin
LEADRasterTwain1.SelectSource ( ) ;
end;

17.

Handle the btnSaveTemplate OnClick event, and code the btnSaveTemplateClick procedure as follows:

procedure TForm1.btnSaveTemplateClick(Sender: TObject);
begin
nRet:= LEADRasterTwain1.SaveTemplate ('c:\test.ltt');
end;

18.

Handle the btnLoadTemplate OnClick event, and code the btnLoadTemplateClick procedure as follows:

procedure TForm1.btnLoadTemplateClick(Sender: TObject);
begin
nRet:= LEADRasterTwain1.LoadTemplate ( 'c:\test.ltt' ) ;
end;

19.

Handle the btnNative button’s OnClick event, and code the btnNativeClick procedure as Follows:

procedure TForm1.btnNativeClick(Sender: TObject);
begin
nXferMode:= L_TWSX_NATIVE;
LEADRasterVariant1.Type_:= VALUE_USHORT;
LEADRasterVariant1.LongValue:= nXferMode;
TwainSetCapability ( L_ICAP_XFERMECH,
LEADRasterVariant1.DefaultInterface,
L_TWTY_UINT16 );
end;

20.

Handle the btnMemBuf button’s OnClick event, and code the btnMemBufClick procedure as follows:

procedure TForm1.btnMemBufClick(Sender: TObject);
begin
nXferMode:= L_TWSX_MEMORY;
LEADRasterVariant1.Type_:= VALUE_USHORT;
LEADRasterVariant1.LongValue:= nXferMode;
TwainSetCapability ( L_ICAP_XFERMECH, LEADRasterVariant1.DefaultInterface, L_TWTY_UINT16 );
end;

21.

Handle the btnFile option OnClick event, and code the btnFileClick procedure as follows:

procedure TForm1.btnFileClick(Sender: TObject);
begin
nXferMode:= L_TWSX_FILE;
LEADRasterVariant1.Type_:= VALUE_USHORT;
LEADRasterVariant1.LongValue:= nXferMode;
TwainSetCapability ( L_ICAP_XFERMECH, LEADRasterVariant1.DefaultInterface, L_TWTY_UINT16 );
LEADRasterTwain1. FileTransferName := 'c:\twain.bmp';
end;

22.

Handle the LEADRasterTwain1 OnAcquirePageEvent event, and code the LEADRasterTwain1AcquirePageEvent procedure as follows:

procedure TForm1.LEADRasterTwain1AcquirePageEvent(Sender: TObject;
pBitmap: Integer);
begin
ShowMessage ( 'Acquisition of Image Done' ) ;
LEADRasterView1.Raster.InsertBitmapListItem ( -1, pBitmap ) ;
end;

23.

Add the TwainSetCapability function body to the Unit1 file.

Function TForm1.TwainSetCapability ( uCapability: Integer; CapVal: LEADRasterVariant; uItemType: Integer): Integer;
var
iRet: Integer;
begin
LEADTwainCapability1.EnableMethodErrors:= False;
LEADTwainCapability1.CapInfo.Capability:= uCapability;
LEADTwainCapability1.CapInfo.ConType:= L_TWON_ONEVALUE;
LEADTwainCapability1.CapOneValue.OneValItemType:= uItemType;
LEADTwainCapability1.CapOneValue.OneValCapValue:= CapVal;

iRet:= LEADRasterTwain1.SetCapability2 (LEADTwainCapability1.DefaultInterface, L_LTWAIN_CAPABILITY_SET);
TwainSetCapability:= iRet;
end;

24.

Run your program to test it.


Using the Fast TWAIN Feature (Delphi 6.0)

Take the following steps to start a project and to add some code that acquires images using Fast Twain:

1. | Start Delphi 6.0.
2. | If you didn’t import LEAD Raster Twain before, import it as follows:
 | On the Project pull-down menu, use the Import Type library… and select the LEAD RasterTwain Object Library (14). Press install, and then compile and install the package dclusr.dpk.
3. | From the ActiveX controls tab, add the LEAD Raster Twain control and the LEAD Twain Capability control to your form.
4. | Add the following declaration to the private section of Unit1:

nRet: Integer;

5. | At the top of your form, add a check box and name it as follows:
 | Name | Caption
 | chkUseBufferSize | Use Buffer Size
6. | Add 2 radio buttons to your form, and name them as follows:
 | Name | Caption
 | rbNative | Native Mode
 | rbMemory | Memory Mode
7. | Add 1 button to your form, and name it as follows:
 | Name | Caption
 | btnAcquire | Fast Acquire
8. | Add 2 Edit boxes to your form, and name them as follows:

edtBufferSize
edtFName

9.

Handle the Form1 OnCreate event, and code the FormCreate procedure as follows:

procedure TForm1.FormCreate(Sender: TObject);
begin
LEADRasterTwain1.UnlockSupport ( L_SUPPORT_DOCUMENT, 'TestKey' ) ;
LEADRasterTwain1.InitSession ( Handle ) ;
LEADRasterTwain1.EnableMethodErrors:= False;
rbMemory.Checked:= True;
end;

10.

Handle the Form1 OnClose event, and code the FormClose procedure as follows:

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
LEADRasterTwain1.EndSession ( ) ;
end;

11.

Handle the btnAcquire control's OnClick event, and code the btnAcquireClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

procedure TForm1.btnAcquireClick(Sender: TObject);
begin
if ( rbMemory.Checked = True ) then
begin
LEADRasterTwain1.FastTransferMode:= L_LTWAIN_BUFFER_MODE ;
LEADRasterTwain1.FastFormat:= FILE_CCITT_GROUP4 ;
end
else
begin
LEADRasterTwain1.FastTransferMode:= L_LTWAIN_NATIVE_MODE ;
LEADRasterTwain1.FastFormat:= FILE_TIF;
end;

LEADRasterTwain1.FastBitsPerPixel:= 1;
LEADRasterTwain1.FastUsePreferredBufferSize:= chkUseBufferSize.Checked;
if ( LEADRasterTwain1.FastUsePreferredBufferSize ) then
LEADRasterTwain1.FastBufferSize:= StrToInt(edtBufferSize.Text);

nRet:= LEADRasterTwain1.AcquireMulti (edtFName.Text, L_LTWAIN_SHOW_USER_INTERFACE Or L_LTWAIN_USE_THREAD_MODE, True);
if ( nRet = 0 ) then
ShowMessage ( 'Fast Scanning process completed successfully...' )
else
ShowMessage ( 'The AcquireMulti method failed, Error = ' + IntToStr ( nRet ) ) ;
end;

12. | Add LTDLLDef to the uses section of Unit1.
13. | Save your project and run your program to test it.


Get a Fast Twain Scan from a Scanner (Delphi 6.0)

Take the following steps to start a project and to add some code to find the fastest configuration for your scanner using the LEADTOOLS Fast TWAIN feature:

1. | Start Delphi 6.0.
2. | If you didn’t import LEAD Raster before, import it as follows:
 | On the Project pull-down menu, use the Import Type library… and select the LEAD Raster Object Library (14). Press install, and then compile and install the package dclusr.dpk.
3. | If you didn’t import LEAD Raster Twain before, import it as follows:
 | On the Project pull-down menu, use the Import Type library… and select the LEAD RasterTwain Object Library (14). Press install, and then compile and install the package dclusr.dpk.
4. | From the ActiveX controls tab, add the LEAD Raster Twain control to your form.
5. | At the top of your form, add 3 button controls and name them as follows:
 | Name | Caption
 | btnSelectSource | Select Source
 | btnFindFastConfig | Find Fast Config.
 | btnAcquireFastConfig | Acquire Fast Config.
6. | Declare the following variable in the public section of Unit1.

nRet: Integer;

7.

Handle the Form1 OnCreate event, and code the FormCreate procedure as follows:

procedure TForm1.FormCreate(Sender: TObject);
begin
LEADRasterTwain1.InitSession ( Handle ) ;
LEADRasterTwain1.EnableMethodErrors:= False;

{ Unlock Document support.
Note that this is a sample key, which will not work in your toolkit. }
LEADRasterTwain1.UnlockSupport ( L_SUPPORT_DOCUMENT, 'TestKey' ) ;
end;

8.

Handle the Form1 OnClose event, and code the FormClose procedure as follows:

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
LEADRasterTwain1.EndSession ( ) ;
end;

9.

Handle the btnSelectSource OnClick event, and code the btnSelectSourceClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

procedure TForm1.btnSelectSourceClick(Sender: TObject);
begin
LEADRasterTwain1.SelectSource ( ) ;
end;

10.

Handle the btnFindFastConfig OnClick event, and code the btnFindFastConfigClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

procedure TForm1.btnFindFastConfigClick(Sender: TObject);
begin
LEADRasterTwain1.UserFastConfigsCount := 0;
LEADRasterTwain1.EnableFastConfigEvent := False;
nRet:= LEADRasterTwain1.FindFastConfig ('c:\temp', L_LTWAIN_SHOW_USER_INTERFACE Or L_LTWAIN_USE_THREAD_MODE, 8, 5);

if ( nRet = 0 ) Then
ShowMessage ('Find Fast Configuration process completed.' )
else
ShowMessage ('An error occurred during the Finding Fast Configuration process.' ) ;
end;

11.

Handle the btnAcquireFastConfig OnClick event, and code the btnAcquireFastConfigClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

procedure TForm1.btnAcquireFastConfigClick(Sender: TObject);
begin
LEADRasterTwain1.FastTransferMode := LEADRasterTwain1.BestFastConfig.TransferMode;
LEADRasterTwain1.FastFormat := LEADRasterTwain1.BestFastConfig.FileFormat;
LEADRasterTwain1.FastBitsPerPixel := LEADRasterTwain1.BestFastConfig.BitsPerPixel;
LEADRasterTwain1.FastBufferSize := LEADRasterTwain1.BestFastConfig.BufferSize;

LEADRasterTwain1.FastUsePreferredBufferSize := True;
LEADRasterTwain1.EnableAcquireMultiEvent:= False;

nRet := LEADRasterTwain1.AcquireMulti ('c:\temp\test', L_LTWAIN_SHOW_USER_INTERFACE, True);

if ( nRet = 0 ) Then
ShowMessage ( Image acquisition using the Fast TWAIN Configuration is completed.' )
else
ShowMessage ( 'An error occurred while acquiring images using the Fast TWAIN Configuration.' ) ;
end;

11. | Add LTRASTERLib_TLB to the uses section of Unit1.
12. | Save your project and run your program to test it.


Set/Get a Twain Capability (Delphi 6.0)

Take the following steps to start a project and to add some code to use the Get/Set capability methods and then acquire your image using the newly set capability:

1. | Start Delphi 6.0.
2. | If you didn’t import LEAD Raster before, import it as follows:
 | On the Project pull-down menu, use Import Type library… and select the LEAD Raster Object Library (14). Press install, and then compile and install the package dclusr.dpk.
3. | If you didn’t import LEAD Raster Twain before, import it as follows:
 | On the Project pull-down menu, use Import Type library… and select the LEAD RasterTwain Object Library (14). Press install, and then compile and install the package dclusr.dpk.
4. | From the ActiveX controls tab, add a LEAD Raster Twain control, and 3 LEAD Twain Capability controls to your form.
5. | If you didn’t import LEAD Raster Variant before, import it as follows:
6. | On the Project pull-down menu, use the Import Type library… and select the LEAD Raster Variant Object Library (14). Press install, and then compile and install the package dclusr.dpk.
7. | At the top of your form, add 4 button controls and name them as follows:
 | Name | Caption
 | btnSelectSource | Select Source
 | btnUseCapability | Use Capability
 | btnSetBrightness | Set Brightness
 | btnAcquire | Acquire
8. | Declare the following variable in the public section of Unit1:

nRet: Integer;

9.

Handle the Form1 OnCreate event, and code the FormCreate procedure as follows:

procedure TForm1.FormCreate(Sender: TObject);
begin
LEADRasterTwain1.InitSession ( Handle ) ;
LEADRasterTwain1.EnableMethodErrors:= False;

{ Unlock Document support.
Note that this is a sample key, which will not work in your toolkit. }
LEADRasterTwain1.UnlockSupport ( L_SUPPORT_DOCUMENT, 'TestKey' ) ;
end;

10.

Handle the Form1 OnClose event, and code the FormClose procedure as follows:

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
LEADRasterTwain1.EndSession ( ) ;
end;

11.

Handle the btnSelectSource OnClick event, and code the btnSelectSourceClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

procedure TForm1.btnSelectSourceClick(Sender: TObject);
begin
LEADRasterTwain1.SelectSource ( ) ;
end;

12.

Handle the btnUseCapability OnClick event, and code the btnUseCapabilityClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

procedure TForm1.btnUseCapabilityClick(Sender: TObject);
var
Xfer: LEADRasterVariant;
begin
LEADTwainCapability1. EnableMethodErrors := False;
LEADTwainCapability1.CapInfo. ConType := L_TWON_ONEVALUE;
LEADTwainCapability1.CapInfo. Capability := L_ICAP_XFERMECH;

nRet:= LEADRasterTwain1. GetCapability2 ( LEADTwainCapability1.DefaultInterface, L_LTWAIN_CAPABILITY_GETCURRENT ) ;
if ( nRet = 0 ) then
begin
Xfer:= LEADTwainCapability1.CapOneValue. OneValCapValue ;
if ( Xfer.LongValue <> L_TWSX_FILE ) then
begin
LEADTwainCapability2. EnableMethodErrors := False;
LEADTwainCapability2.CapInfo. Capability := L_ICAP_XFERMECH;
LEADTwainCapability2.CapInfo. ConType := L_TWON_ONEVALUE;

LEADTwainCapability2.CapOneValue. OneValItemType := L_TWTY_UINT16;
LEADTwainCapability2.CapOneValue. OneValCapValue := Xfer;

nRet:= LEADRasterTwain1. SetCapability2 ( LEADTwainCapability2.DefaultInterface, L_LTWAIN_CAPABILITY_SET );
end
else
ShowMessage ( 'The Transfer mode is File' ) ;
end
else
ShowMessage ( 'Error occurred in GetCapability method' ) ;
end;

13.

Handle the btnSetBrightness OnClick event, and code the btnSetBrightnessClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

procedure TForm1.btnSetBrightnessClick(Sender: TObject);
var
iRet: Integer;
CapVal: LEADRasterVariant;
begin
LEADTwainCapability3.CapInfo. ConType := L_TWON_ONEVALUE;
LEADTwainCapability3.CapInfo. Capability := L_ICAP_BRIGHTNESS;
LEADTwainCapability3. EnableMethodErrors := False;
CapVal:= coLEADRasterVariant.Create ( );
CapVal.Type_:= VALUE_USHORT;
CapVal.LongValue:= 50;

LEADTwainCapability3.CapOneValue. OneValItemType := L_TWTY_FIX32;
LEADTwainCapability3.CapOneValue. OneValCapValue := CapVal;

iRet:= LEADRasterTwain1. SetCapability2 (LEADTwainCapability3.DefaultInterface, L_LTWAIN_CAPABILITY_SET);
if (iRet <> 0) then
ShowMessage ( 'Error Setting Capability' ) ;
end;

14.

Handle the btnAcquire OnClick event, and code the btnAcquireClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

procedure TForm1.btnAcquireClick(Sender: TObject);
begin
LEADRasterTwain1.FileTransferName:= 'c:\twain.bmp';
nRet:= LEADRasterTwain1.Acquire ( L_LTWAIN_SHOW_USER_INTERFACE ) ;
if ( nRet <> 0 ) then
ShowMessage ( 'Error acquiring from source' ) ;
end;

15. | Add ‘LTRASTERLib_TLB’, and ‘LTRASTERVARIANTLib_TLB’ units to the uses section of Unit1.
16. | Save your project and run your program to test it.


Tutorial for C++ Builder Programmers

The following topics provide brief and simple examples to help you learn how to use the LEAD RasterTwain Object Library.

LEADTOOLS Twain COM supports UNICODE. For more information on using the samples in this help file with UNICODE, please refer to A Special Note About UNICODE Support.

Note:

These tutorial examples are intended to be easy to understand and easy to test. The example programs in the EXAMPLES subdirectory provide more in depth design and more detailed code.

Acquiring an Image

Using the Fast TWAIN Feature

Get a Fast Twain Scan from a Scanner

Set/Get a Twain Capability


Acquiring an Image (C++ Builder)

Take the following steps to start a project and to add some code that acquires an image from a TWAIN source:

1. | Start C++ Builder 4.0.
2. | If you didn’t install LEAD RasterView Control, install it as follows:
 | On the Component pull-down menu, use the Import ActiveX Control… and select the LEAD RasterView Control (14). Press install, and then compile and install the package dclusr40.bpk.
3. | Select the LEAD RasterView control and add it to Form1. Size and position the control as you want it to appear at run time.
4. | On the Project pull-down menu, use the Import Type library… and select the LEAD RasterTwain Object Library (14). Press OK.
6. | If you didn’t import LEAD Raster Variant before, import it as follows:
7. | On the Project pull-down menu, use the Import Type library… and select the LEAD Raster Variant Object Library (14). Press install, and then compile and install the package dclusr40.bpk.
5. | If you didn’t install LEADEventSink Control, install it as follows:
 | On the Component pull-down menu, use install Component …, and browse to LEADXX\Include\LEvntSnk.pas. Press OK, then compile and install the package dclusr40.bpk.
6. | Open the LEvntSnk.hpp file and delete those lines below from the TLEADAbstractEventSink class and save the file.

private:
void *__IDispatch; /* IDispatch */

public:
operator IDispatch*(void) { return (IDispatch*)&__IDispatch; }
operator IUnknown*(void) { return (IUnknown*)&__IDispatch; }

7. | From the ActiveX controls, add the LEADEventSink control to Form1.
8. | Add the following code to the private section of Unit1.h:

LEADTwainCapability * pTwainCap;
LEADRasterTwain * pRasterTwain;
int nXferMode;
int nRet;
int TwainSetCapability ( short iCapability, long lCapVal, short iItemType );

9.

Handle the Form1 OnCreate event, and code the FormCreate procedure as follows:

void __fastcall TForm1::FormCreate(TObject *Sender)
{
CoCreateInstance (CLSID_LEADRasterTwainCapability, NULL, CLSCTX_ALL, IID_ICapability, (void **)&pTwainCap);
CoCreateInstance(CLSID_LEADRasterTwain, NULL, CLSCTX_ALL, IID_ILEADRasterTwain, (void**)&pRasterTwain);

pRasterTwain->InitSession ( (long)Handle ) ;
LEADEventSink1->Connect ( pRasterTwain, DIID__LEADRasterTwainEvents );
}

10.

Handle the Form1 OnClose event, and code the FormClose procedure as follows:

void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
pRasterTwain->EndSession ( ) ;
if ( pTwainCap )
pTwainCap->Release ( ) ;

if ( pRasterTwain )
pRasterTwain->Release ( ) ;
}

11. | At the top of Form1, add six Buttons and three Option Buttons and name them as follows:
 | Name | Caption
 | btnOK | OK
 | btnCancel | Cancel
 | btnAcquire | Acquire
 | btnSelectSource | Select Source
 | btnNative | Native
 | btnMemBuf | Memory Buffered
 | btnFile | File
 | btnSaveTemplate | Save Template File
 | btnLoadTemplate | Load Template File
12. | Handle the btnOK OnClick event, and code the btnOKClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

void __fastcall TForm1::btnOKClick(TObject *Sender)
{
Close ( ) ;
}

13.

Handle the btnCancel OnClick event, and code the btnCancelClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code:

void __fastcall TForm1::btnCancelClick(TObject *Sender)
{
Close ( ) ;
}

14.

Handle the btnAcquire OnClick event, and code the btnAcquireClick procedure as follows:

void __fastcall TForm1::btnAcquireClick(TObject *Sender)
{
pRasterTwain->Acquire ( L_LTWAIN_SHOW_USER_INTERFACE ) ;
}

15.

Handle the btnSelectSource OnClick event, and code the btnSelectSourceClick procedure as follows:

void __fastcall TForm1::btnSelectSourceClick(TObject *Sender)
{
pRasterTwain->SelectSource ( ) ;
}

16.

Handle the btnSaveTemplate OnClick event, and code the btnSaveTemplateClick procedure as follows:

void __fastcall TForm1::btnSaveTemplateClick(TObject *Sender)
{
nRet= pRasterTwain->SaveTemplate ( AnsiToOLESTR ( "c:\\test.ltt" ) ) ;
}

17.

Handle btnLoadTemplate OnClick event, and code the btnLoadTemplateClick procedure as follows:

void __fastcall TForm1::btnLoadTemplateClick(TObject *Sender)
{
nRet= pRasterTwain->LoadTemplate ( AnsiToOLESTR ( "c:\\test.ltt" ) ) ;
}

18.

Handle the btnNative option button’s OnClick event, and code the btnNativeClick procedure as Follows:

void __fastcall TForm1::btnNativeClick(TObject *Sender)
{
ILEADRasterVariant* pCapVal= NULL;

CoCreateInstance(CLSID_LEADRasterVariant,

NULL,

CLSCTX_ALL,

IID_ILEADRasterVariant,

(void**)&pCapVal );

nXferMode= L_TWSX_NATIVE;

pCapVal->Type= VALUE_USHORT;

pCapVal->LongValue= nXferMode;

TwainSetCapability ( L_ICAP_XFERMECH, pCapVal, L_TWTY_UINT16 );

if ( pCapVal )

pCapVal->Release ( );
}

19.

Handle the btnMemBuf Option button’s OnClick event, and code the btnMemBufClick procedure as follows:

void __fastcall TForm1::btnMemBufClick(TObject *Sender)
{
ILEADRasterVariant* pCapVal= NULL;

CoCreateInstance(CLSID_LEADRasterVariant,

NULL,

CLSCTX_ALL,

IID_ILEADRasterVariant,

(void**)&pCapVal );

nXferMode= L_TWSX_MEMORY;

pCapVal->Type= VALUE_USHORT;

pCapVal->LongValue= nXferMode;

TwainSetCapability ( L_ICAP_XFERMECH, pCapVal, L_TWTY_UINT16 );

if ( pCapVal )

pCapVal->Release ( );
}

20.

Handle the btnFile Option button’s OnClick event, and code the btnFileClick procedure as follows:

void __fastcall TForm1::btnFileClick(TObject *Sender)
{
ILEADRasterVariant* pCapVal= NULL;

CoCreateInstance(CLSID_LEADRasterVariant,

NULL,

CLSCTX_ALL,

IID_ILEADRasterVariant,

(void**)&pCapVal );

nXferMode= L_TWSX_FILE;

pCapVal->Type= VALUE_USHORT;

pCapVal->LongValue= nXferMode;

TwainSetCapability ( L_ICAP_XFERMECH, pCapVal, L_TWTY_UINT16 );

pRasterTwain->FileTransferName = AnsiToOLESTR ( "c:\\twain.bmp" );

if ( pCapVal )

pCapVal->Release ( );
}

21.

Handle the LEADEventSink1 OnInvoke event, and code the LEADEventSink1Invoke procedure as follows:

void __fastcall TForm1::LEADEventSink1Invoke(TObject *Sender, int DispID,
const TGUID &IID, int LocaleID, WORD Flags, tagDISPPARAMS &Params,
Pointer varResult, Pointer ExcepInfo, Pointer ArgErr)
{
switch (DispID)
{
case LEADRASTER_TWAIN_EVENTS_ACQUIREPAGEEVENT:
{
int pBitmap= OleVariant ( Params.rgvarg[0] ) ;
ShowMessage ( "Acquisition of Image Done" ) ;
LEADRasterView1->Raster->InsertBitmapListItem ( -1, pBitmap ) ;
}
break;
}
}

22.

Add the TwainSetCapability function body to the Unit1 file.

int TForm1::TwainSetCapability ( short iCapability, ILEADRasterVariant* pCapVal, short iItemType )
{
int iRet;

pTwainCap->EnableMethodErrors = False;
pTwainCap->CapInfo->Capability = iCapability;
pTwainCap->CapInfo->ConType = L_TWON_ONEVALUE;
pTwainCap->CapOneValue->OneValItemType = iItemType;
pTwainCap->CapOneValue->set_OneValCapValue ( pCapVal ) ;

iRet= pRasterTwain->SetCapability2 ( pTwainCap, L_LTWAIN_CAPABILITY_SET);
return iRet;
}

23.

In Unit1.h file include these files.

#include "LTRASTERTWAINLib_TLB.h"

#include "LTRASTERVARIANTLib_TLB.h"

24.

Run your program to test it.


Using the Fast TWAIN Feature (C++ Builder)

Take the following steps to start a project and to add some code that acquires images using Fast Twain:

1. | Start C++ Builder 4.0.
2. | On the Project pull-down menu, use Import Type library… and select the LEAD RasterTwain Object Library (14). Press OK.
3. | On the Project pull-down menu, use Import Type library… and select the LEAD Raster Object Library (14). Press OK.
4. | On the Project pull-down menu, use Import Type library… and select the LEAD RasterIO Object Library (14). Press OK.
5. | Add the following code to the private section of Unit1.h:

LEADTwainCapability* pTwainCap;
LEADRasterTwain* pRasterTwain;
int nRet;

6.

Handle the Form1 OnCreate event, and code the FormCreate procedure as follows:

void __fastcall TForm1::FormCreate(TObject *Sender)
{
CoCreateInstance (CLSID_LEADRasterTwainCapability, NULL, CLSCTX_ALL, IID_ICapability, (void **)&pTwainCap);
CoCreateInstance(CLSID_LEADRasterTwain, NULL, CLSCTX_ALL, IID_ILEADRasterTwain, (void**)&pRasterTwain);
pRasterTwain->UnlockSupport ( L_SUPPORT_DOCUMENT, AnsiToOLESTR ( "TestKey" ) ) ;
pRasterTwain->InitSession ( (long)Handle ) ;
pRasterTwain->EnableMethodErrors = False;
rbMemory->Checked= True;
}

7.

Handle the Form1 OnClose event, and code the FormClose procedure as follows:

void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
pRasterTwain->EndSession ( ) ;
if ( pTwainCap )
pTwainCap->Release ( ) ;

if ( pRasterTwain )
pRasterTwain->Release ( ) ;
}

8. | At the top of Form1, add check box and name it as follows:
 | Name | Caption
 | chkUseBufferSize | Use Buffer Size
9. | Add 2 radio buttons, and name them as follows:
 | Name | Caption
 | rbNative | Native Mode
 | rbMemory | Memory Mode
10. | Add 1 button, and name it as follows:
 | Name | Caption
 | btnAcquire | Fast Acquire
11. | Add 2 Edit boxes, and name them as follows:

edtBufferSize
edtFName

12.

Handle the btnAcquire control's OnClick event, and code the btnAcquireClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

void __fastcall TForm1::btnAcquireClick(TObject *Sender)
{
if ( rbMemory->Checked )
{
pRasterTwain->FastTransferMode = L_LTWAIN_BUFFER_MODE ;
pRasterTwain->FastFormat = FILE_CCITT_GROUP4 ;
}
else
{
pRasterTwain->FastTransferMode = L_LTWAIN_NATIVE_MODE ;
pRasterTwain->FastFormat = FILE_TIF;
}

pRasterTwain->FastBitsPerPixel = 1;
pRasterTwain->FastUsePreferredBufferSize = chkUseBufferSize->Checked;
if ( pRasterTwain->FastUsePreferredBufferSize )
pRasterTwain->FastBufferSize = StrToInt(edtBufferSize->Text);

nRet= pRasterTwain->AcquireMulti ( AnsiToOLESTR ( edtFName->Text.c_str() ), (long)(L_LTWAIN_SHOW_USER_INTERFACE | L_LTWAIN_USE_THREAD_MODE), (TOLEBOOL)true );
if ( nRet == 0 )
ShowMessage ( "Fast Scanning process done successfully..." ) ;
else
ShowMessage ( "AcquireMulti failed, Error = " + IntToStr ( nRet ) ) ;
}

13.

In the Unit1.h file include these files.

#include "LTRASTERTWAINLib_TLB.h"
#include "LTRASTERLib_TLB.h"
#include "LTRASTERIOLib_TLB.h"

14.

Save your project and run your program to test it.


Get a Fast Twain Scan from a Scanner (C++ Builder)

Take the following steps to start a project and to add some code to find the fastest configuration for your scanner using the LEADTOOLS Fast TWAIN feature:

1. | Start C++ Builder 4.0.
2. | On the Project pull-down menu, use Import Type library… and select the LEAD Raster Object Library (14). Press OK.
3. | On the Project pull-down menu, use Import Type library… and select the LEAD RasterTwain Object Library (14). Press OK.
4. | Declare the following variables in the public section of "Unit1.h":

LEADRasterTwain * pRasterTwain;
int nRet;

5.

Handle the Form1 OnCreate event, and code the FormCreate procedure as follows:

void __fastcall TForm1::FormCreate(TObject *Sender)
{
CoInitialize ( NULL ) ;
CoCreateInstance(CLSID_LEADRasterTwain, NULL, CLSCTX_ALL, IID_ILEADRasterTwain, (void**)&pRasterTwain);
pRasterTwain->InitSession ( (long)Handle ) ;
pRasterTwain->EnableMethodErrors = false;

/* Unlock Document support.
Note that this is a sample key, which will not work in your toolkit. */
pRasterTwain->UnlockSupport ( L_SUPPORT_DOCUMENT, AnsiToOLESTR("TestKey") ) ;
}

6.

Handle the Form1 OnClose event, and code the FormClose procedure as follows:

void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
if ( pRasterTwain )
{
pRasterTwain->EndSession ( ) ;
pRasterTwain->Release( );
}
pRasterTwain= NULL;
CoUninitialize ( ) ;
}

7. | At the top of Form1, add 3 button controls and name them as follows:
 | Name | Caption
 | btnSelectSource | Select Source
 | btnFindFastConfig | Find Fast Config.
 | btnAcquireFastConfig | Acquire Fast Config.
8. | Handle the btnSelectSource OnClick event, and code the btnSelectSourceClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

void __fastcall TForm1::btnSelectSourceClick(TObject *Sender)
{
pRasterTwain->SelectSource ( ) ;
}

9.

Handle the btnFindFastConfig OnClick event, and code the btnFindFastConfigClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

void __fastcall TForm1::btnFindFastConfigClick(TObject *Sender)
{
pRasterTwain->UserFastConfigsCount = 0;
pRasterTwain->EnableFastConfigEvent = false;
nRet= pRasterTwain->FindFastConfig ( AnsiToOLESTR("c:\\temp"), L_LTWAIN_SHOW_USER_INTERFACE | L_LTWAIN_USE_THREAD_MODE, 8, 5);

if ( nRet == 0 )
ShowMessage ("Find Fast Configuration process completed" );
else
ShowMessage ("An error occurred during the Finding Fast Configuration process." ) ;
}

10.

Handle the btnAcquireFastConfig OnClick event, and code the btnAcquireFastConfigClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

void __fastcall TForm1::btnAcquireFastConfigClick(TObject *Sender)
{
pRasterTwain->FastTransferMode = pRasterTwain->BestFastConfig->TransferMode;
pRasterTwain->FastFormat = pRasterTwain->BestFastConfig->FileFormat;
pRasterTwain->FastBitsPerPixel = pRasterTwain->BestFastConfig->BitsPerPixel;
pRasterTwain->FastBufferSize = pRasterTwain->BestFastConfig->BufferSize;

pRasterTwain->FastUsePreferredBufferSize = true;
pRasterTwain->EnableAcquireMultiEvent = false;

nRet= pRasterTwain->AcquireMulti ( AnsiToOLESTR("c:\\temp\\test"), L_LTWAIN_SHOW_USER_INTERFACE, true);

if ( nRet == 0 )
ShowMessage ( "Image acquisition using the Fast TWAIN Configuration is completed." );
else
ShowMessage ( "An error occurred while acquiring an image using the Fast TWAIN Configuration." ) ;
}

11.

In the Unit1.h file include these files.

#include "LTRASTERTWAINLib_TLB.h"
#include "LTRASTERLib_TLB.h"

12.

Save your project and run your program to test it.


Set/Get a Twain Capability (C++ Builder)

Take the following steps to start a project and to add some code to use the Get/Set capability methods and then acquire your image using the newly set capability:

1. | Start C++ Builder 4.0.
2. | On the Project pull-down menu, use Import Type library… and select the LEAD Raster Object Library (14). Press OK.
3. | On the Project pull-down menu, use Import Type library… and select the LEAD RasterTwain Object Library (14). Press OK.
4. | If you didn’t import LEAD Raster Variant before, import it as follows:
5. | On the Project pull-down menu, use the Import Type library… and select the LEAD Raster Variant Object Library (14). Press install, and then compile and install the package dclusr40.bpk.
6. | Declare the following variables in the public section of "Unit1.h":

LEADTwainCapability* pTwainCap1;

LEADTwainCapability* pTwainCap2;

LEADTwainCapability* pTwainCap3;
LEADRasterTwain* pRasterTwain;
int nRet;

7.

Handle the Form1 OnCreate event, and code the FormCreate procedure as follows:

void __fastcall TForm1::FormCreate(TObject *Sender)
{
CoInitialize ( NULL );

CoCreateInstance (CLSID_LEADRasterTwain, NULL, CLSCTX_ALL, IID_ILEADRasterTwain, (void**)&pRasterTwain);

CoCreateInstance (CLSID_LEADRasterTwainCapability, NULL, CLSCTX_ALL, IID_ICapability, (void **)&pTwainCap1);

CoCreateInstance (CLSID_LEADRasterTwainCapability, NULL, CLSCTX_ALL, IID_ICapability, (void **)&pTwainCap2);

CoCreateInstance (CLSID_LEADRasterTwainCapability, NULL, CLSCTX_ALL, IID_ICapability, (void **)&pTwainCap3);

/* Unlock Document support.

Note that this is a sample key, which will not work in your toolkit. */

if ( pRasterTwain && pTwainCap1 && pTwainCap2 && pTwainCap3 )

{

pRasterTwain->InitSession ( (long)Handle );

pRasterTwain->EnableMethodErrors = false;

pRasterTwain->UnlockSupport ( L_SUPPORT_DOCUMENT, AnsiToOLESTR("TestKey") );

}
}

8.

Handle the Form1 OnClose event, and code the FormClose procedure as follows:

void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
if ( pRasterTwain )

{

pRasterTwain->EndSession ( );

pRasterTwain->Release( );

}

if ( pTwainCap1 )

pTwainCap1->Release( );

if ( pTwainCap1 )

pTwainCap1->Release( );

if ( pTwainCap2 )

pTwainCap2->Release( );

if ( pTwainCap3 )

pTwainCap3->Release( );

pRasterTwain= NULL;

pTwainCap1= NULL;

pTwainCap2= NULL;

pTwainCap3= NULL;

CoUninitialize ( );
}

9. | At the top of Form1, add 4 button controls and name them as follows:
 | Name | Caption
 | btnSelectSource | Select Source
 | btnUseCapability | Use Capability
 | btnSetBrightness | Set Brightness
 | BtnAcquire | Acquire
10. | Handle the btnSelectSource OnClick event, and code the btnSelectSourceClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

void __fastcall TForm1::btnSelectSourceClick(TObject *Sender)
{
pRasterTwain->SelectSource ( ) ;
}

11.

Handle the btnUseCapability OnClick event, and code the btnUseCapabilityClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

void __fastcall TForm1::btnUseCapabilityClick(TObject *Sender)
{
ILEADRasterVariant* pXfer= NULL;

pTwainCap1->set_EnableMethodErrors ( false );

pTwainCap1->CapInfo->ConType = L_TWON_ONEVALUE;

pTwainCap1->CapInfo->Capability = L_ICAP_XFERMECH;

nRet = pRasterTwain->GetCapability2 ( pTwainCap1, L_LTWAIN_CAPABILITY_GETCURRENT );

if ( nRet == 0 )

{

pXfer = pTwainCap1->CapOneValue->get_OneValCapValue();

if ( pXfer->LongValue != L_TWSX_FILE )

{

pTwainCap2->EnableMethodErrors = false;

pTwainCap2->CapInfo->Capability = L_ICAP_XFERMECH;

pTwainCap2->CapInfo->ConType = L_TWON_ONEVALUE;

pTwainCap2->CapOneValue->OneValItemType = L_TWTY_UINT16;

pTwainCap2->CapOneValue->OneValCapValue = pXfer;

nRet = pRasterTwain->SetCapability2 ( pTwainCap2, L_LTWAIN_CAPABILITY_SET );

}

else

ShowMessage ( "The Transfer mode is File" );

}

else

ShowMessage ( "Error occurred in the GetCapability method" );
}

12.

Handle the btnSetBrightness OnClick event, and code the btnSetBrightnessClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

void __fastcall TForm1::btnSetBrightnessClick(TObject *Sender)
{
int iRet;

ILEADRasterVariant* pCapVal;

pTwainCap3->CapInfo->ConType = L_TWON_ONEVALUE;

pTwainCap3->CapInfo->Capability = L_ICAP_BRIGHTNESS;

pTwainCap3->EnableMethodErrors = false;

CoCreateInstance(CLSID_LEADRasterVariant,

NULL,

CLSCTX_ALL,

IID_ILEADRasterVariant,

(void**)&pCapVal );

pCapVal->Type= VALUE_USHORT;

pCapVal->LongValue= 50;

pTwainCap3->CapOneValue->OneValItemType = L_TWTY_FIX32;

pTwainCap3->CapOneValue->set_OneValCapValue ( pCapVal );

iRet= pRasterTwain->SetCapability2 (pTwainCap3, L_LTWAIN_CAPABILITY_SET);

if (iRet != 0)

ShowMessage ( "Error Setting Capability" );

if (pCapVal)

pCapVal->Release();
}

13.

Handle the btnAcquire OnClick event, and code the btnAcquireClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

void __fastcall TForm1::btnAcquireClick(TObject *Sender)
{
pRasterTwain->FileTransferName = AnsiToOLESTR("c:\\twain.bmp");
nRet= pRasterTwain->Acquire ( L_LTWAIN_SHOW_USER_INTERFACE ) ;
if ( nRet != 0 )
ShowMessage ( "Error acquiring from source" ) ;
}

14.

In the Unit1.h file include these files.

#include "LTRASTERTWAINLib_TLB.h"
#include "LTRASTERLib_TLB.h"

#include "LTRASTERVARIANTLib_TLB.h"

15.

Save your project and run your program to test it.


Tutorial for C++ Builder 6.0 Programmers

The following topics provide brief and simple examples to help you learn how to use the LEAD RasterTwain Object Library.

For general information about the syntax requirements of this interface, refer to Visual C++ 5.0 Syntax .

LEADTOOLS Twain COM supports UNICODE. For more information on using the samples in this help file with UNICODE, please refer to A Special Note About UNICODE Support.

Note:

These tutorial examples are intended to be easy to understand and easy to test. The example programs in the EXAMPLES subdirectory provide more in depth design and more detailed code.

Acquiring an Image

Using the Fast TWAIN Feature

Get a Fast Twain Scan from a Scanner

Set/Get a Twain Capability


Acquiring an Image (C++ Builder 6.0)

Take the following steps to start a project and to add some code that acquires an image from a TWAIN source:

1. | Start C++ Builder 6.0.
2. | If you didn’t install LEAD RasterView Control, install it as follows:
 | On the Component pull-down menu, use Import ActiveX Control… and select the LEAD RasterView Control (14). Press install, and then compile and install the package dclusr.bpk.
3. | Select the LEAD RasterView control and add it to your form. Size and position the control, as you want it to appear at run time.
4. | If you didn’t import LEAD Raster Twain before, import it as follows:
 | On the Project pull-down menu, use Import Type library… and select the LEAD RasterTwain Object Library (14). Press install, and then compile and install the package dclusr.bpk.
5. | From the ActiveX controls tab, add the LEAD Raster Twain and LEAD Twain Capability to your form.
6. | If you didn’t import LEAD Raster Variant before, import it as follows:
7. | On the Project pull-down menu, use the Import Type library… and select the LEAD Raster Variant Object Library (14). Press install, and then compile and install the package dclusr.bpk.
8. | From the ActiveX controls tab, add the LEAD Raster Variant control to your form.
9. | At the top of your form, add 9 Buttons and name them as follows:
 | Name | Caption
 | btnOK | OK
 | btnCancel | Cancel
 | btnAcquire | Acquire
 | btnSelectSource | Select Source
 | btnSaveTemplate | Save Template File
 | btnLoadTemplate | Load Template File
 | btnNative | Native
 | btnMemBuf | Memory Buffered
 | btnFile | File
10. | Add the following code to the private section of "Unit1.h".

int nXferMode;
int nRet;
int TwainSetCapability ( short iCapability,
ILEADRasterVariant* pCapVal,
short iItemType );

11.

Handle the Form1 OnCreate event, and code the FormCreate procedure as follows:

void __fastcall TForm1::FormCreate(TObject *Sender)
{
LEADRasterTwain1->InitSession ( (long)Handle ) ;
}

12.

Handle the Form1 OnClose event, and code the FormClose procedure as follows:

void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
LEADRasterTwain1->EndSession ();
}

13.

Handle the btnOK OnClick event, and code the btnOKClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

void __fastcall TForm1::btnOKClick(TObject *Sender)
{
Close ( ) ;
}

14.

Handle the btnCancel OnClick event, and code the btnCancelClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code:

void __fastcall TForm1::btnCancelClick(TObject *Sender)
{
Close ( ) ;
}

15.

Handle the btnAcquire OnClick event, and code the btnAcquireClick procedure as follows:

void __fastcall TForm1::btnAcquireClick(TObject *Sender)
{
LEADRasterTwain1->Acquire ( L_LTWAIN_SHOW_USER_INTERFACE ) ;
}

16.

Handle the btnSelectSource OnClick event, and code the btnSelectSourceClick procedure as follows:

void __fastcall TForm1::btnSelectSourceClick(TObject *Sender)
{
LEADRasterTwain1->SelectSource ( ) ;
}

17.

Handle the btnSaveTemplate OnClick event, and code the btnSaveTemplateClick procedure as follows:

void __fastcall TForm1::btnSaveTemplateClick(TObject *Sender)
{
nRet= LEADRasterTwain1->SaveTemplate ( AnsiToOLESTR("c:\\test.ltt") );
}

18.

Handle the btnLoadTemplate OnClick event, and code the btnLoadTemplateClick procedure as follows:

void __fastcall TForm1::btnLoadTemplateClick(TObject *Sender)
{
nRet= LEADRasterTwain1->LoadTemplate ( AnsiToOLESTR("c:\\test.ltt") ) ;
}

19.

Handle the btnNative button’s OnClick event, and code the btnNativeClick procedure as Follows:

void __fastcall TForm1::btnNativeClick(TObject *Sender)
{
nXferMode= L_TWSX_NATIVE;
LEADRasterVariant1->set_Type ( VALUE_USHORT );
LEADRasterVariant1->set_LongValue ( nXferMode );

TwainSetCapability ( L_ICAP_XFERMECH,
LEADRasterVariant1->GetDefaultInterface(),
L_TWTY_UINT16 );
}

20.

Handle the btnMemBuf button’s OnClick event, and code the btnMemBufClick procedure as follows:

void __fastcall TForm1::btnMemBufClick(TObject *Sender)
{
nXferMode= L_TWSX_MEMORY;
LEADRasterVariant1->set_Type ( VALUE_USHORT );
LEADRasterVariant1->set_LongValue ( nXferMode );
TwainSetCapability ( L_ICAP_XFERMECH,
LEADRasterVariant1->GetDefaultInterface( ),
L_TWTY_UINT16 );
}

21.

Handle the btnFile OnClick event, and code the btnFileClick procedure as follows:

void __fastcall TForm1::btnFileClick(TObject *Sender)
{
nXferMode= L_TWSX_FILE;
LEADRasterVariant1->set_Type ( VALUE_USHORT );
LEADRasterVariant1->set_LongValue ( nXferMode );

TwainSetCapability ( L_ICAP_XFERMECH, LEADRasterVariant1->GetDefaultInterface ( ), L_TWTY_UINT16 ) ;
LEADRasterTwain1->set_FileTransferName( AnsiToOLESTR ("c:\\twain.bmp") );
}

22.

Handle the LEADRasterTwain1 OnAcquirePageEvent event, and code the LEADRasterTwain1AcquirePageEvent procedure as follows:

void __fastcall TForm1::LEADRasterTwain1AcquirePageEvent(TObject *Sender,
long pBitmap)
{
ShowMessage ( "Acquisition of Image Done" ) ;
LEADRasterView1->Raster->InsertBitmapListItem ( -1, pBitmap ) ;
}

23.

Add the TwainSetCapability function body to the Unit1 file.

int TForm1::TwainSetCapability ( short iCapability, ILEADRasterVariant* pCapVal, short iItemType )
{
int iRet;

LEADTwainCapability1->set_EnableMethodErrors( false );
LEADTwainCapability1->CapInfo-> Capability = iCapability;
LEADTwainCapability1->CapInfo-> ConType = L_TWON_ONEVALUE;
LEADTwainCapability1->CapOneValue-> OneValItemType = iItemType;
LEADTwainCapability1->CapOneValue->set_ OneValCapValue ( pCapVal );

iRet= LEADRasterTwain1-> SetCapability2 ( LEADTwainCapability1->GetDefaultInterface(),
L_LTWAIN_CAPABILITY_SET);
return iRet;
}

24.

Run your program to test it.


Using the Fast TWAIN Feature (C++ Builder 6.0)

Take the following steps to start a project and to add some code that acquires the images using Fast Twain:

1. | Start C++ Builder 6.0.
2. | If you didn’t import LEAD Raster Twain before, import it as follows:
 | On the Project pull-down menu, use Import Type library… and select the LEAD RasterTwain Object Library (14). Press install, and then compile and install the package dclusr.bpk.
3. | If you didn’t import LEAD Raster IO before, import it as follows:
 | On the Project pull-down menu, use Import Type library… and select the LEAD Raster IO Object Library (14). Press install, and then compile and install the package dclusr.bpk.
4. | If you didn’t import LEAD Raster before, import it as follows:
 | On the Project pull-down menu, use Import Type library… and select the LEAD Raster Object Library (14). Press install, and then compile and install the package dclusr.bpk.
5. | From the ActiveX controls tab, add the LEAD Raster Twain and LEAD Twain Capability controls to your form.
6. | Add the following declaration to the private section of "Unit1.h":

int nRet;

7. | At the top of your form, add a check box and name it as follows:
 | Name | Caption
 | chkUseBufferSize | Use Buffer Size
8. | Add 2 radio buttons to your form, and name them as follows:
 | Name | Caption
 | RbNative | Native Mode
 | RbMemory | Memory Mode
9. | Add 1 button to your form, and name it as follows:
 | Name | Caption
 | btnAcquire | Fast Acquire
10. | Add 2 Edit boxes to your form, and name them as follows:

edtBufferSize
edtFName

11.

Handle the Form1 OnCreate event, and code the FormCreate procedure as follows:

void __fastcall TForm1::FormCreate(TObject *Sender)
{
LEADRasterTwain1->UnlockSupport ( L_SUPPORT_DOCUMENT, AnsiToOLESTR("TestKey") ) ;
LEADRasterTwain1->InitSession ( (long)Handle ) ;
LEADRasterTwain1->set_EnableMethodErrors ( false );
rbMemory->Checked= true;
}

12.

Handle the Form1 OnClose event, and code the FormClose procedure as follows:

void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
LEADRasterTwain1->EndSession ( ) ;
}

13.

Handle the btnAcquire control's OnClick event, and code the btnAcquireClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

void __fastcall TForm1::btnAcquireClick(TObject *Sender)
{
if ( rbMemory->Checked )
{
LEADRasterTwain1->set_FastTransferMode ( L_LTWAIN_BUFFER_MODE );
LEADRasterTwain1->set_FastFormat ( FILE_CCITT_GROUP4 );
}
else
{
LEADRasterTwain1->set_FastTransferMode ( L_LTWAIN_NATIVE_MODE );
LEADRasterTwain1->set_FastFormat ( FILE_TIF );
}

LEADRasterTwain1->set_FastBitsPerPixel ( 1 ) ;
LEADRasterTwain1->set_FastUsePreferredBufferSize ( chkUseBufferSize->Checked );
if (LEADRasterTwain1->FastUsePreferredBufferSize )
LEADRasterTwain1->set_FastBufferSize ( StrToInt(edtBufferSize->Text) );

nRet= LEADRasterTwain1->AcquireMulti ( AnsiToOLESTR(edtFName->Text.c_str()), L_LTWAIN_SHOW_USER_INTERFACE | L_LTWAIN_USE_THREAD_MODE, true );
if ( nRet == 0 )
ShowMessage ( "Fast Scanning process done successfully..." );
else
ShowMessage ( "AcquireMulti failed, Error = " + IntToStr ( nRet ) ) ;
}

14.

Include the following files in the "Unit1.h" file.

#include "LTRASTERLib_TLB.h"
#include "LTRASTERIOLib_TLB.h"

15.

Save your project and run your program to test it.


Get a Fast Twain Scan from a Scanner (C++ Builder 6.0)

Take the following steps to start a project and to add some code to find the fastest configuration for your scanner using the LEADTOOLS Fast TWAIN feature:

1. | Start C++ Builder 6.0.
2. | If you didn’t import LEAD Raster before, import it as follows:
 | On the Project pull-down menu, use Import Type library… and select the LEAD Raster Object Library (14). Press install, and then compile and install the package dclusr.bpk.
3. | If you didn’t import LEAD Raster Twain before, import it as follows:
 | On the Project pull-down menu, use Import Type library… and select the LEAD RasterTwain Object Library (14). Press install, and then compile and install the package dclusr.bpk.
4. | From the ActiveX controls tab, add the LEAD Raster Twain control to your form.
5. | At the top of your form, add 3 button controls and name them as follows:
 | Name | Caption
 | btnSelectSource | Select Source
 | btnFindFastConfig | Find Fast Config.
 | btnAcquireFastConfig | Acquire Fast Config.
6. | Declare the following variable in the public section of "Unit1.h".

int nRet;

7.

Handle the Form1 OnCreate event, and code the FormCreate procedure as follows:

void __fastcall TForm1::FormCreate(TObject *Sender)
{
LEADRasterTwain1->InitSession ( (long)Handle ) ;
LEADRasterTwain1->set_EnableMethodErrors ( false );

/* Unlock Document support.
Note that this is a sample key, which will not work in your toolkit. */
LEADRasterTwain1->UnlockSupport ( L_SUPPORT_DOCUMENT, AnsiToOLESTR("TestKey") ) ;
}

8.

Handle the Form1 OnClose event, and code the FormClose procedure as follows:

void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
LEADRasterTwain1->EndSession ( ) ;
}

9.

Handle the btnSelectSource OnClick event, and code the btnSelectSourceClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

void __fastcall TForm1::btnSelectSourceClick(TObject *Sender)
{
LEADRasterTwain1->SelectSource ( ) ;
}

10.

Handle the btnFindFastConfig OnClick event, and code the btnFindFastConfigClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

void __fastcall TForm1::btnFindFastConfigClick(TObject *Sender)
{
LEADRasterTwain1->set_UserFastConfigsCount ( 0 );
LEADRasterTwain1->set_EnableFastConfigEvent ( false );
nRet= LEADRasterTwain1->FindFastConfig ( AnsiToOLESTR("c:\\temp"), L_LTWAIN_SHOW_USER_INTERFACE | L_LTWAIN_USE_THREAD_MODE, 8, 5);

if ( nRet == 0 )
ShowMessage ( "Find Fast Configuration process completed " );
else
ShowMessage ( "An error occurred during the Finding Fast Configuration process." ) ;
}

11.

Handle the btnAcquireFastConfig OnClick event, and code the btnAcquireFastConfigClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

void __fastcall TForm1::btnAcquireFastConfigClick(TObject *Sender)
{
LEADRasterTwain1->set_FastTransferMode (LEADRasterTwain1->BestFastConfig->TransferMode ) ;
LEADRasterTwain1->set_FastFormat (LEADRasterTwain1->BestFastConfig->FileFormat );
LEADRasterTwain1->set_FastBitsPerPixel (LEADRasterTwain1->BestFastConfig->BitsPerPixel );
LEADRasterTwain1->set_FastBufferSize (LEADRasterTwain1->BestFastConfig->BufferSize );

LEADRasterTwain1->set_FastUsePreferredBufferSize ( true );
LEADRasterTwain1->set_EnableAcquireMultiEvent ( false) ;

nRet = LEADRasterTwain1->AcquireMulti ( AnsiToOLESTR("c:\\temp\\test"), L_LTWAIN_SHOW_USER_INTERFACE, true);

if ( nRet == 0 )
ShowMessage ( "Image acquisition using the Fast TWAIN Configuration is completed" );
else
ShowMessage ( "An error occurred while acquiring an image using the Fast TWAIN Configuration." ) ;
}

11.

Include the following file in Unit1.h" file.

#include "LTRASTERLib_TLB.h"

12.

Save your project and run your program to test it.


Set/Get a Twain Capability (C++ Builder 6.0)

Take the following steps to start a project and to add some code to use the Get/Set capability methods and then acquire your image using the newly set capability:

1. | Start C++ Builder 6.0.
2. | If you didn’t import LEAD Raster before, import it as follows:
 | On the Project pull-down menu, use Import Type library… and select the LEAD Raster Object Library (14). Press install, and then compile and install the package dclusr.bpk.
3. | If you didn’t import LEAD Raster Twain before, import it as follows:
 | On the Project pull-down menu, use Import Type library… and select the LEAD RasterTwain Object Library (14). Press install, and then compile and install the package dclusr.bpk.
4. | From the ActiveX controls tab, Add a LEAD Raster Twain control, and 3 LEAD Twain Capability controls to your form.
5. | If you didn’t import LEAD Raster Variant before, import it as follows:
6. | On the Project pull-down menu, use the Import Type library… and select the LEAD Raster Variant Object Library (14). Press install, and then compile and install the package dclusr.bpk.
7. | At the top of your form, add 3 button controls and name them as follows:
 | Name | Caption
 | btnSelectSource | Select Source
 | btnUseCapability | Use Capability
 | btnSetBrightness | Set Brightness
 | btnAcquire | Acquire
8. | Declare the following variable in the public section of "Unit1.h":

int nRet;

9.

Handle the Form1 OnCreate event, and code the FormCreate procedure as follows:

void __fastcall TForm1::FormCreate(TObject *Sender)
{
LEADRasterTwain1->InitSession ( (long)Handle ) ;
LEADRasterTwain1->set_EnableMethodErrors ( false );

/* Unlock Document support.
Note that this is a sample key, which will not work in your toolkit. */
LEADRasterTwain1->UnlockSupport ( L_SUPPORT_DOCUMENT, AnsiToOLESTR("TestKey") ) ;
}

10.

Handle the Form1 OnClose event, and code the FormClose procedure as follows:

void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
LEADRasterTwain1->EndSession ( ) ;
}

11.

Handle the btnSelectSource OnClick event, and code the btnSelectSourceClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

void __fastcall TForm1::btnSelectSourceClick(TObject *Sender)
{
LEADRasterTwain1->SelectSource ( ) ;
}

12.

Handle the btnUseCapability OnClick event, and code the btnUseCapabilityClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

void __fastcall TForm1::btnUseCapabilityClick(TObject *Sender)
{
ILEADRasterVariant* pXfer= NULL;

LEADTwainCapability1->set_EnableMethodErrors ( false );
LEADTwainCapability1->CapInfo-> ConType = L_TWON_ONEVALUE;
LEADTwainCapability1-> CapInfo-> Capability = L_ICAP_XFERMECH;

nRet = LEADRasterTwain1-> GetCapability2 ( LEADTwainCapability1->GetDefaultInterface(), L_LTWAIN_CAPABILITY_GETCURRENT );
if ( nRet == 0 )
{
pXfer = LEADTwainCapability1->CapOneValue->get_ OneValCapValue ();
if ( pXfer->LongValue != L_TWSX_FILE )
{
LEADTwainCapability2->set_EnableMethodErrors ( false );
LEADTwainCapability2-> CapInfo->Capability = L_ICAP_XFERMECH;
LEADTwainCapability2->CapInfo->ConType = L_TWON_ONEVALUE;

LEADTwainCapability2->CapOneValue-> OneValItemType = L_TWTY_UINT16;
LEADTwainCapability2->CapOneValue->set_ OneValCapValue (pXfer);

nRet = LEADRasterTwain1-> SetCapability2 ( LEADTwainCapability2->GetDefaultInterface(), L_LTWAIN_CAPABILITY_SET );
}
else
ShowMessage ( "The Transfer mode is File" );
}
else

ShowMessage ( "Error occurred in the GetCapability method" );
}

13.

Handle the btnSetBrightness OnClick event, and code the btnSetBrightnessClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

void __fastcall TForm1::btnSetBrightnessClick(TObject *Sender)
{
int iRet;
ILEADRasterVariant* pCapVal;

LEADTwainCapability3->CapInfo->ConType = L_TWON_ONEVALUE;
LEADTwainCapability3-> CapInfo-> Capability = L_ICAP_BRIGHTNESS;
LEADTwainCapability3->set_ EnableMethodErrors ( false );
CoCreateInstance(CLSID_LEADRasterVariant,
NULL,
CLSCTX_ALL,
IID_ILEADRasterVariant,
(void**)&pCapVal );
pCapVal->set_Type ( VALUE_USHORT );
pCapVal->set_LongValue ( 50 );

LEADTwainCapability3->CapOneValue-> OneValItemType = L_TWTY_FIX32;
LEADTwainCapability3->CapOneValue->set_ OneValCapValue ( pCapVal );

iRet= LEADRasterTwain1-> SetCapability2 (LEADTwainCapability3->GetDefaultInterface(), L_LTWAIN_CAPABILITY_SET);
if (iRet != 0)
ShowMessage ( "Error Setting Capability" );
if (pCapVal)
pCapVal->Release();
}

14.

Handle the btnAcquire OnClick event, and code the btnAcquireClick procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

void __fastcall TForm1::btnAcquireClick(TObject *Sender)
{
LEADRasterTwain1->set_FileTransferName ( AnsiToOLESTR("c:\\twain.bmp") );
nRet= LEADRasterTwain1->Acquire ( L_LTWAIN_SHOW_USER_INTERFACE );
if ( nRet != 0 )
ShowMessage ( "Error acquiring from source" ) ;
}

15.

Include the following file in the Unit1.h" file.

#include "LTRASTERLib_TLB.h"

16.

Save your project and run your program to test it.


Tutorial for Visual FoxPro 6 Programmers

The following topics provide brief and simple examples to help you learn how to use the LEAD RasterTwain Object Library.

Note:

These tutorial examples are intended to be easy to understand and easy to test. The example programs in the EXAMPLES subdirectory provide more in depth design and more detailed code.

Acquiring an Image

Using the Fast TWAIN Feature

Get a Fast Twain Scan from a Scanner

Miscellaneous Examples


Acquiring an Image (Visual FoxPro 6)

Take the following steps to start a project and to add some code that acquires an image from a TWAIN source:

Note: This tutorial uses the VFPCOM Utility, which can be found on the Microsoft web site at: http://msdn.microsoft.com/vfoxpro/downloads/updates/

1. | Start Visual FoxPro.
2. | On the Tools menu, select Options….
3. | In the Options window, click the Controls tab, display the ActiveX controls, mark the LEAD Raster View Control, click the Set As Default button, then click the OK button. This registers the Raster View control and makes it available for all projects.
4. | On the File menu, select New….
5. | Select the Project option, and click the New File icon.
6. | In the Create window, select the directory where you want to create a project. Specify your project name, then click the Create button.
7. | In the Project window, expand the Documents icon, select the Forms icon, click the New button, then click the New Form icon. (Do not use the wizard.)
8. | Click the View Classes icon, and select ActiveX Controls.
9. | Select the LEAD Raster View Control icon on the toolbar.
10. | Size and position the control as you want it to appear at run time, and change the name of the control to RasterView1.
11. | In the Project Manager window, expand the Code icon, select the Programs icon and click the New button.
12. | Insert the following code into the newly created PRG file:

public oVFPCOM, oRasterTwain, oTwainCap, TwainEventClass, TheForm

#define C_VFPCOMCLASS 'vfpcom.comutil'
oVFPCOM = CreateObject(C_VFPCOMCLASS)
oRasterTwain = CreateObject("LEADRasterTwain.LEADRasterTwain.140")
oTwainCap = CreateObject("LEADTwainCapability.LEADTwainCapability.140")
TwainEventClass = CreateObject("_LEADRasterTwainEvents")
nError = oVFPCOM.BindEvents(oRasterTwain, TwainEventClass)

Do Form form1.scx

&& Following class definition was created using the VFPCOM utility
DEFINE CLASS _LEADRasterTwainEvents AS custom
PROCEDURE AcquirePageEvent(pBitmap)
MessageBox("Acquisition of Image Done")
TheForm.RasterView1.Raster.InsertBitmapListItem(-1, pBitmap)
ENDPROC
ENDDEFINE

13.

Add the following code to the form's Init procedure:

oRasterTwain.InitSession(ThisForm.RasterView1.Window)
TheForm = ThisForm

14.

Add the following code to the form's Unload procedure:

oRasterTwain.EndSession()

15. | Add seven Command Buttons to your form and name them as follows:
 | Name | Caption
 | Acquire | Acquire
 | SelectSource | SelectSource
 | Native | Native
 | MemBuf | Memory Buffered
 | File | File
 | SaveTemplate | Save Template File
 | LoadTemplate | Load Template File
16. | Code the Acquire button Click procedure as follows:

#define L_LTWAIN_SHOW_USER_INTERFACE 1
oRasterTwain.Acquire(L_LTWAIN_SHOW_USER_INTERFACE)

17.

Code the SelectSource button Click procedure as follows:

oRasterTwain.SelectSource()

18.

Code the SaveTemplate button Click procedure as follows:

oRasterTwain.SaveTemplate("c:\test.ltt")

19.

Code LoadTemplate button Click procedure as follows:

oRasterTwain.LoadTemplate("c:\test.ltt")

20.

Code the Native button Click procedure as Follows:

#define L_TWSX_NATIVE 0
ThisForm.SetCapabilityXferMech(L_TWSX_NATIVE)

21.

Code the MemBuf button Click Procedure as follows:

#define L_TWSX_MEMORY 2
ThisForm.SetCapabilityXferMech(L_TWSX_MEMORY)

22.

Code the File button Click Procedure as follows:

#define L_TWSX_FILE 1
ThisForm.SetCapabilityXferMech(L_TWSX_FILE)
oRasterTwain.FileTransferName = "c:\twain.bmp"

23.

On the Form menu, choose New Method. Name the new method SetCapabilityXferMech and code its procedure as follows:

Parameter XferType
#define L_ICAP_XFERMECH 259
#define L_TWTY_UINT16 4
#define L_TWON_ONEVALUE 5
#define L_LTWAIN_CAPABILITY_SET 1
#define VALUE_USHORT 4
CapVal = CreateObject("LEADRasterVariant.LEADRasterVariant.140")
CapVal.Type = VALUE_USHORT
CapVal.LongValue = XferType

oTwainCap.EnableMethodErrors = .F.
oTwainCap.CapInfo.Capability = L_ICAP_XFERMECH
oTwainCap.CapInfo.ConType = L_TWON_ONEVALUE
oTwainCap.CapOneValue.OneValItemType = L_TWTY_UINT16
oTwainCap.CapOneValue.OneValCapValue = CapVal

oRasterTwain.SetCapability2(oTwainCap, L_LTWAIN_CAPABILITY_SET)

24.

Run your PRG program to test it.


Using the Fast TWAIN Feature (Visual FoxPro 6)

Take the following steps to add some code that acquires the images using Fast Twain:

1. | Start with the project you created in Acquiring an Image (Visual FoxPro 6).
2. | Add an option group with 2 radio buttons to form1 and change its name to optTransMode. Set the buttons' captions to "Native Mode" and "Memory Mode", respectively.
3. | Change the code of the form's Init procedure to be as follows:

#DEFINE L_SUPPORT_DOCUMENT 0
&& Unlock Document support.
&& Note that this is a sample key, which will not work in your toolkit.
oRasterTwain.UnlockSupport(L_SUPPORT_DOCUMENT, "DocKey")
oRasterTwain.InitSession(ThisForm.RasterView1.Window)
TheForm = ThisForm
oRasterTwain.EnableMethodErrors = .F.
ThisForm.optTransMode.Value = 2 &&Memory

4. | Add a check box to form1 and name it as follows:
 | Name | Caption
 | chkUseBufferSize | Use Buffer Size
5. | Add one button to form1 and name it as follows:
 | Name | Caption
 | FastAcquire | Fast Acquire
6. | Add two text boxes and name them as follows:

txtBufferSize

txtFName

7.

Code the Fast Acquire button Click procedure as follows:

#define L_LTWAIN_BUFFER_MODE 2
#define L_LTWAIN_NATIVE_MODE 4
#define FILE_CCITT_GROUP4 29
#define FILE_TIF 3
#define L_LTWAIN_SHOW_USER_INTERFACE 1
#define L_LTWAIN_USE_THREAD_MODE 8
If ThisForm.optTransMode.Value = 2 Then &&Memory
oRasterTwain.FastTransferMode = L_LTWAIN_BUFFER_MODE
oRasterTwain.FastFormat = FILE_CCITT_GROUP4
Else
oRasterTwain.FastTransferMode = L_LTWAIN_NATIVE_MODE
oRasterTwain.FastFormat = FILE_TIF
EndIf

oRasterTwain.FastBitsPerPixel = 1
oRasterTwain.FastUsePreferredBufferSize = ThisForm.chkUseBufferSize.Value
oRasterTwain.FastBufferSize = Val(ThisForm.txtBufferSize.Text)

nRet = oRasterTwain.AcquireMulti(ThisForm.txtFName.Text, BitOR(L_LTWAIN_SHOW_USER_INTERFACE, L_LTWAIN_USE_THREAD_MODE), .T.)
If nRet = 0 Then
MessageBox("Fast Scanning process done successfully...")
Else
MessageBox("The AcquireMulti method failed, Error = " + Str(nRet))
EndIf

8.

Save your project and run the PRG program to test it.


Get a Fast Twain Scan from a Scanner (Visual FoxPro 6)

Take the following steps to start a project and to add some code to find the fastest configuration for your scanner using the LEADTOOLS Fast TWAIN feature:

1. | Start with the project you created in Using the Fast TWAIN Feature (Visual FoxPro 6)
2. | Add 2 command buttons to the project's form as follows:
 | Name | Caption
 | FindFastConfig | Find Fast Config
 | AcquireFastConfig | Acquire Fast Config
3. | Code the "Find Fast Config" Click procedure as follows:

#define L_LTWAIN_SHOW_USER_INTERFACE 1
#define L_LTWAIN_USE_THREAD_MODE 8
oRasterTwain.UserFastConfigsCount = 0
oRasterTwain.EnableFastConfigEvent = .F.
nRet = oRasterTwain.FindFastConfig("c:\temp", BitOR(L_LTWAIN_SHOW_USER_INTERFACE, L_LTWAIN_USE_THREAD_MODE), 8, 5)
If nRet = 0 Then
MessageBox("Find Fast Configuration process completed")
Else
MessageBox("An error occurred while Finding the Fast Configuration")
EndIf

4.

Code the "Acquire Fast Config" Click procedure as follows:

#define L_LTWAIN_SHOW_USER_INTERFACE 1
oRasterTwain.FastTransferMode = oRasterTwain.BestFastConfig.TransferMode
oRasterTwain.FastFormat = oRasterTwain.BestFastConfig.FileFormat
oRasterTwain.FastBitsPerPixel = oRasterTwain.BestFastConfig.BitsPerPixel
oRasterTwain.FastBufferSize = oRasterTwain.BestFastConfig.BufferSize
oRasterTwain.FastUsePreferredBufferSize = .T.
oRasterTwain.EnableAcquireMultiEvent = .F.

nRet = oRasterTwain.AcquireMulti("c:\temp\test", L_LTWAIN_SHOW_USER_INTERFACE, .T.)

If nRet = 0 Then
MessageBox("Image acquisition using the Fast TWAIN Configuration is completed.")
Else
MessageBox("An error occurred while acquiring images using the Fast TWAIN Configuration.")
EndIf

5.

Save your project and run the PRG program to test it.


Miscellaneous Examples (Visual FoxPro 6)

You can test any of the following examples by adding a command button to one of the previous lessons in the tutorial, and pasting the sample code in the Click procedure.

Acquire Example for Visual FoxPro 6

AcquireMulti Example for Visual FoxPro 6

AcquireSourceName Example for Visual FoxPro 6

Capability Example for Visual FoxPro 6

EndSession Example for Visual FoxPro 6

FamilyName Example for Visual FoxPro 6

FastConfigEvent Example for Visual FoxPro 6

FindFastConfig Example for Visual FoxPro 6

GetCapability2 Example for Visual FoxPro 6

GetScanConfigs Example for Visual FoxPro 6

IsAvailable Example for Visual FoxPro 6

LoadTemplate Example for Visual FoxPro 6

PtwInfo Example for Visual FoxPro 6

QueryCapability Example for Visual FoxPro 6

RightMargin Example for Visual FoxPro 6

SelectedFamilyName Example for Visual FoxPro 6

SelectedSourceName Example for Visual FoxPro 6

SelectSource Example for Visual FoxPro 6

ShowTemplateDlg Example for Visual FoxPro 6

SourceName Example for Visual FoxPro 6

UnlockSupport Example for Visual FoxPro 6


Acquire Example for Visual FoxPro 6

#define L_LTWAIN_SHOW_USER_INTERFACE 1

oRasterTwain.FileTransferName = "c:\twain.bmp"
oRasterTwain.MemBufSize = oRasterTwain.MemBufSize * 2
nRet = oRasterTwain.Acquire(L_LTWAIN_SHOW_USER_INTERFACE)
If nRet <> 0 Then
MessageBox("Error acquiring from source")
EndIf

&& To get the image scanned by the Acquire method and pass it
&& to a LEADRasterView control, you must implement a handler
&& for the AcquirePageEvent. For details, see the tutorial Acquiring an Image.
DEFINE CLASS _LEADRasterTwainEvents AS custom
PROCEDURE AcquirePageEvent(pBitmap)
TheForm.RasterView1.Raster.InsertBitmapListItem (-1, pBitmap)
ENDPROC
ENDDEFINE


AcquireMulti Example for Visual FoxPro 6

#define L_LTWAIN_SHOW_USER_INTERFACE 1
#define L_LTWAIN_BUFFER_MODE 2
#define FILE_TIF 3

oRasterTwain.FastTransferMode = L_LTWAIN_BUFFER_MODE
oRasterTwain.FastFormat = FILE_TIF
oRasterTwain.FastBitsPerPixel = 1
oRasterTwain.FastBufferSize = 0
oRasterTwain.FastUsePreferredBufferSize = .T.
oRasterTwain.EnableAcquireMultiEvent = .T.

nRet = oRasterTwain.AcquireMulti("c:\Twain\test.tif", L_LTWAIN_SHOW_USER_INTERFACE, .T.)

If nRet = 0 Then
MessageBox("The Fast Twain method was successful")
Else
MessageBox("Error occurred during the fast Twain method!!!")
EndIf

For details about implementing the event, see the tutorial Acquiring an Image.

PROCEDURE AcquireMultiEvent(nPage, bstrFileName, bFinishScan)
If bFinishScan Then
strMsg = "The page # " + Str(nPage) + " is scanned and saved to file name " + bstrFileName
MessageBox(strMsg)
EndIf
ENDPROC


AcquireSourceName Example for Visual FoxPro 6

#define L_LTWAIN_SHOW_USER_INTERFACE 1

oRasterTwain.AcquireSourceName = "TWAIN Source Name"
nRet = oRasterTwain.Acquire(L_LTWAIN_SHOW_USER_INTERFACE)
If nRet <> 0 Then
MessageBox("Error acquiring from source")
EndIf


Capability Example for Visual FoxPro 6

#define L_TWON_ONEVALUE 5
#define L_TWSX_FILE 1
#define L_LTWAIN_CAPABILITY_SET 1
#define L_ICAP_XFERMECH 259
#define L_TWTY_UINT16 4

#define VALUE_USHORT 4
CapVal = CreateObject("LEADRasterVariant.LEADRasterVariant.140")
CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWSX_FILE

lCount = oRasterTwain.CapsCount
For n = 0 To lCount - 1 Step 1
lCapability = oRasterTwain.Capability(n)

&& Check for capability and do other processing
If lCapability = L_ICAP_XFERMECH Then
oTwainCap.EnableMethodErrors = .F.
oTwainCap.CapInfo.Capability = L_ICAP_XFERMECH
oTwainCap.CapInfo.ConType = L_TWON_ONEVALUE
oTwainCap.CapOneValue.OneValItemType = L_TWTY_UINT16
oTwainCap.CapOneValue.OneValCapValue = CapVal

iRet = oRasterTwain.SetCapability2(oTwainCap, L_LTWAIN_CAPABILITY_SET)
EndIf
Next


CapArray Example for Visual FoxPro 6

#define L_LTWAIN_CAPABILITY_SET 1
#define L_TWTY_UINT16 4
#define L_TWON_ARRAY 3
#define L_ICAP_FILTER 4358
#define L_TWFT_RED 0
#define L_TWFT_GREEN 1

oTwainCap.CapInfo.ConType = L_TWON_ARRAY
oTwainCap.CapInfo.Capability = L_ICAP_FILTER
oTwainCap.EnableMethodErrors = .F.

oTwainCap.CapArray.ArrayItemType = L_TWTY_UINT16
oTwainCap.CapArray.ArrayNumOfItems = 2

#define VALUE_USHORT 4
CapVal = CreateObject("LEADRasterVariant.LEADRasterVariant.140")
CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWFT_RED

oTwainCap.CapArray.ArrayCapValue(0) = CapVal
CapVal.LongValue = L_TWFT_GREEN
oTwainCap.CapArray.ArrayCapValue(1) = CapVal

iRet = oRasterTwain.SetCapability2(oTwainCap, L_LTWAIN_CAPABILITY_SET)
If iRet <> 0 Then
MessageBox("Error Setting Capability")
EndIf


CapEnum Example for Visual FoxPro 6

#define L_TWTY_UINT16 4
#define L_LTWAIN_CAPABILITY_SET 1
#define L_ICAP_UNITS 258
#define L_TWUN_INCHES 0
#define L_TWUN_TWIPS 4
#define L_TWON_ENUMERATION 4

oTwainCap.CapInfo.ConType = L_TWON_ENUMERATION
oTwainCap.CapInfo.Capability = L_ICAP_UNITS
oTwainCap.EnableMethodErrors = .F.

oTwainCap.CapEnum.EnumNumOfItems = 2

#define VALUE_USHORT 4
CapVal = CreateObject("LEADRasterVariant.LEADRasterVariant.140")
CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWUN_INCHES
oTwainCap.CapEnum.EnumCapValue(0) = CapVal
CapVal.LongValue = L_TWUN_TWIPS
oTwainCap.CapEnum.EnumCapValue(1) = CapVal

oTwainCap.CapEnum.EnumCurrentIndex = 0
oTwainCap.CapEnum.EnumDefaultIndex = 0
oTwainCap.CapEnum.EnumItemType = L_TWTY_UINT16

iRet = oRasterTwain.SetCapability2(oTwainCap, L_LTWAIN_CAPABILITY_SET)
If iRet <> 0 Then
MessageBox("Error Setting Capability:"+Str(iRet))
EndIf


CapOneValue Example for Visual FoxPro 6

#define L_TWON_ONEVALUE 5
#define L_LTWAIN_CAPABILITY_SET 1
#define L_TWTY_UINT16 4
#define L_ICAP_UNITS 258
#define L_TWUN_INCHES 0

oTwainCap.CapInfo.ConType = L_TWON_ONEVALUE
oTwainCap.CapInfo.Capability = L_ICAP_UNITS
oTwainCap.EnableMethodErrors = .F.

#define VALUE_USHORT 4
CapVal = CreateObject("LEADRasterVariant.LEADRasterVariant.140")
CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWUN_INCHES

oTwainCap.CapOneValue.OneValItemType = L_TWTY_UINT16
oTwainCap.CapOneValue.OneValCapValue = CapVal

iRet = oRasterTwain.SetCapability2(oTwainCap, L_LTWAIN_CAPABILITY_SET)
If iRet <> 0 Then
MessageBox("Error Setting Capability")
EndIf


CapRange Example for Visual FoxPro 6

#define L_LTWAIN_CAPABILITY_SET 1
#define L_TWON_RANGE 6
#define L_ICAP_JPEGQUALITY 4435
#define L_TWTY_INT16 1
#define L_TWJQ_MEDIUM (-2)
#define L_TWJQ_HIGH (-1)

oTwainCap.CapInfo.ConType = L_TWON_RANGE
oTwainCap.CapInfo.Capability = L_ICAP_JPEGQUALITY
oTwainCap.EnableMethodErrors = .F.

#define VALUE_USHORT 4
CapVal = CreateObject("LEADRasterVariant.LEADRasterVariant.140")
CapVal.Type = VALUE_USHORT

oTwainCap.CapRange.RangeItemType = L_TWTY_INT16
CapVal.LongValue = L_TWJQ_MEDIUM
oTwainCap.CapRange.RangeCurrentValue = CapVal
CapVal.LongValue = L_TWJQ_HIGH
oTwainCap.CapRange.RangeDefaultValue = CapVal
CapVal.LongValue = 0
oTwainCap.CapRange.RangeMinimumValue = CapVal
CapVal.LongValue = 50
oTwainCap.CapRange.RangeMaximumValue = CapVal
CapVal.LongValue = 10
oTwainCap.CapRange.RangeStepSize = CapVal

iRet = oRasterTwain.SetCapability2(oTwainCap, L_LTWAIN_CAPABILITY_SET)
If iRet <> 0 Then
MessageBox("Error Setting Capability"+Str(iRet))
EndIf


EndSession Example for Visual FoxPro 6

#define L_TWON_ONEVALUE 5
#define L_LTWAIN_CAPABILITY_SET 1
#define L_LTWAIN_SHOW_USER_INTERFACE 1
#define L_TWTY_UINT16 4
#define L_ICAP_XFERMECH 259
#define L_TWSX_NATIVE 0

objRasterTwain = CreateObject("LEADRasterTwain.LEADRasterTwain.140")
objRasterTwain.InitSession(ThisForm.RasterView1.Window)
objTwainCap = CreateObject("LEADTwainCapability.LEADTwainCapability.140")
objTwainCap.EnableMethodErrors = .F.
objTwainCap.CapInfo.Capability = L_ICAP_XFERMECH
objTwainCap.CapInfo.ConType = L_TWON_ONEVALUE
objTwainCap.CapOneValue.OneValItemType = L_TWTY_UINT16
#define VALUE_USHORT 4
CapVal = CreateObject("LEADRasterVariant.LEADRasterVariant.140")
CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWSX_NATIVE

objTwainCap.CapOneValue.OneValCapValue = CapVal

objRasterTwain.SetCapability2(objTwainCap, L_LTWAIN_CAPABILITY_SET)

objRasterTwain.Acquire(L_LTWAIN_SHOW_USER_INTERFACE)
objRasterTwain.EndSession()


FamilyName Example for Visual FoxPro 6

lCount = oRasterTwain.SourceCount
For n = 0 To lCount - 1 Step 1
strMsg = "Source Name = " + oRasterTwain.SourceName(n) +Chr(13)+ ;
"Product Family Name = " + oRasterTwain.FamilyName(n) + Chr(13) ;
+ "Manufacturer Name = " + oRasterTwain.ManufacturerName(n)
MessageBox(strMsg)
Next


FastConfigEvent Example for Visual FoxPro 6

#define L_LTWAIN_SHOW_USER_INTERFACE 1
#define L_LTWAIN_USE_THREAD_MODE 8
oRasterTwain.UserFastConfigsCount = 0
oRasterTwain.EnableFastConfigEvent = .T.
nRet = oRasterTwain.FindFastConfig("c:\temp", BitOR(L_LTWAIN_SHOW_USER_INTERFACE, L_LTWAIN_USE_THREAD_MODE), 8, 5)
If nRet = 0 Then
MessageBox("Find Fast Configuration process completed")
Else
MessageBox("An error occurred while Finding Fast Configuration")
EndIf

For details about implementing the event, see the tutorial Acquiring an Image.

PROCEDURE FastConfigEvent(pltResConfig)
If pltResConfig.Success Then
str = "Transfer Mode = " + Str(pltResConfig.TransferMode) + Chr(13) + ;
"File Format = " + Str(pltResConfig.FileFormat) + Chr(13) + ;
"Buffer Size = " + Str(pltResConfig.BufferSize) + Chr(13) + ;
"Bits Per Pixel = " + Str(pltResConfig.BitsPerPixel) + Chr(13) + ;
"Required Time = " + Str(pltResConfig.RequiredTime)

MessageBox(str, 0, "Resulting Scan Configurations...")
Else
MessageBox("The tested scan configuration failed...")
EndIf
oRasterTwain.StopFindFastConfig = .F.
ENDPROC


FindFastConfig Example for Visual FoxPro 6

#define L_LTWAIN_SHOW_USER_INTERFACE 1
#define FILE_TIF 3
#define L_LTWAIN_FILE_MODE 1
#define FILE_BMP 6

oRasterTwain.EnableFastConfigEvent = .T.
oRasterTwain.UserFastConfigsCount = 2
oRasterTwain.UserFastConfigs(0).TransferMode = L_LTWAIN_FILE_MODE
oRasterTwain.UserFastConfigs(0).FileFormat = FILE_BMP
oRasterTwain.UserFastConfigs(0).BitsPerPixel = 1

oRasterTwain.UserFastConfigs(1).TransferMode = L_LTWAIN_FILE_MODE
oRasterTwain.UserFastConfigs(1).FileFormat = FILE_TIF
oRasterTwain.UserFastConfigs(1).BitsPerPixel = 1

nRet = oRasterTwain.FindFastConfig("c:\Twain", L_LTWAIN_SHOW_USER_INTERFACE, 1, 0)
If nRet = 0 Then
MessageBox("FindFastConfig method was successful")
MessageBox("Result Scan Configs count = " + Str(oRasterTwain.FastConfigsResultCount))

str = "Transfer Mode = " + Str(oRasterTwain.FastConfigsResult(0).TransferMode) + Chr(13) + ;
"File Format = " + Str(oRasterTwain.FastConfigsResult(0).FileFormat) + Chr(13) + ;
"Buffer Size = " + Str(oRasterTwain.FastConfigsResult(0).BufferSize) + Chr(13) + ;
"Required Time = " + Str(oRasterTwain.FastConfigsResult(0).RequiredTime)

MessageBox(str, 0, "Result Scan Configurations...")

str = "Transfer Mode = " + Str(oRasterTwain.BestFastConfig.TransferMode) + Chr(13) + ;
"File Format = " + Str(oRasterTwain.BestFastConfig.FileFormat) + Chr(13) + ;
"Buffer Size = " + Str(oRasterTwain.BestFastConfig.BufferSize) + Chr(13) + ;
"Required Time = " + Str(oRasterTwain.BestFastConfig.RequiredTime)

MessageBox(str, 0, "Resulting Scan Configurations...")
Else
MessageBox("Error occurred in the FindFastConfig method!!!", 0, "Error!!!")
EndIf

For details about implementing the event, see the tutorial Acquiring an Image.

PROCEDURE FastConfigEvent(pltResConfig)
&& ... set your code here
oRasterTwain.StopFindFastConfig = .F.
ENDPROC


GetCapability2 Example for Visual FoxPro 6

#define L_LTWAIN_CAPABILITY_GETCURRENT 3
#define L_ICAP_UNITS 258
#define L_TWON_DONTCARE16 -1

oTwainCap.CapInfo.ConType = L_TWON_DONTCARE16
oTwainCap.CapInfo.Capability = L_ICAP_UNITS
iRet = oRasterTwain.GetCapability2(oTwainCap, L_LTWAIN_CAPABILITY_GETCURRENT)
If iRet <> 0 Then
MessageBox("Error Getting Capability"+Str(iRet))
EndIf


GetScanConfigs Example for Visual FoxPro 6

#define L_LTWAIN_BUFFER_MODE 2

nRet = oRasterTwain.GetScanConfigs(1, L_LTWAIN_BUFFER_MODE, 5)
If nRet = 0 Then
MessageBox("GetScanConfigs method was successful.")
MessageBox("Scan Configuration count = " + Str(oRasterTwain.ScanConfigCount))

str = "Transfer Mode = " + Str(oRasterTwain.ScanConfig(0).TransferMode) + Chr(13) + ;
"File Format = " + Str(oRasterTwain.ScanConfig(0).FileFormat) + Chr(13) + ;
"Buffer Size = " + Str(oRasterTwain.ScanConfig(0).BufferSize) + Chr(13) + ;
"Required Time = " + Str(oRasterTwain.ScanConfig(0).RequiredTime)

MessageBox(str, 0, "Scan Configurations...")
Else
MessageBox("Error occurred in the GetScanConfigs method!!!", 0, "Error!!!")
EndIf


IsAvailable Example for Visual FoxPro 6

&& check the status of TWAIN
If oRasterTwain.IsAvailable (ThisForm.RasterView1.Window) Then
MessageBox("Twain is installed")
Else
MessageBox("Twain is not installed")
EndIf


LoadTemplate Example for Visual FoxPro 6

#define L_TWON_ONEVALUE 5
#define L_LTWAIN_CAPABILITY_SET 1
#define L_TWTY_UINT16 4
#define L_ICAP_XFERMECH 259
#define L_TWSX_NATIVE 0

oRasterTwain.LoadTemplate("c:\test.ltt")

oTwainCap.CapInfo.Capability = L_ICAP_XFERMECH
oTwainCap.CapInfo.ConType = L_TWON_ONEVALUE
oTwainCap.CapOneValue.OneValItemType = L_TWTY_UINT16
#define VALUE_USHORT 4
CapVal = CreateObject("LEADRasterVariant.LEADRasterVariant.140")
CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWSX_NATIVE
oTwainCap.CapOneValue.OneValCapValue = CapVal

oRasterTwain.SetCapability2(oTwainCap, L_LTWAIN_CAPABILITY_SET)

oRasterTwain.SaveTemplate("c:\test.ltt")


PtwInfo Example for Visual FoxPro 6

For details about implementing events, see the tutorial Acquiring an Image.

#define L_TWEI_BARCODETEXT 4610
#define L_TWTY_UINT32 5
#define L_TWCC_SUCCESS 0
PROCEDURE AcquirePageEvent(pBitmap)
&& This sample code is for the AcquirePageEvent handler
&& For another example, refer to the tutorials
twExt = CreateObject("twExtImageInfo.twExtImageInfo.140")

twExt.NumOfInfos = 1
twExt.ptwInfo(0).InfoID = L_TWEI_BARCODETEXT
twExt.ptwInfo(0).ItemType = L_TWTY_UINT32
nRet = RasTwain.GetExtImageInfo(twExt)
If nRet = 0 Then
If twExt.ptwInfo(0).CondCode = L_TWCC_SUCCESS Then
For n = 0 To twExt.ptwInfo(0).NumOfItems - 1 Step 1
Item = twExt.ptwInfo(0).Item(n, 0)
&& Do more processing on the item value
Next
EndIf
EndIf
ENDPROC


QueryCapability Example for Visual FoxPro 6

#define L_ICAP_UNITS 258
#define L_TWON_DONTCARE16 -1
oRasTwainCap = CreateObject("LEADRasterTwainCapability.LEADRasterTwainCapability.140")
oRasTwainCap.ConType = L_TWON_DONTCARE16
oRasTwainCap.Capability = L_ICAP_UNITS

iRet = oRasterTwain.QueryCapability(oRasTwainCap)
If iRet <> 0 Then
MessageBox("Error Getting Capability"+Str(iRet))
EndIf


RightMargin Example for Visual FoxPro 6

#define L_TWON_ONEVALUE 5
#define L_LTWAIN_CAPABILITY_SET 1
#define L_TWTY_UINT16 4
#define L_TWUN_INCHES 0
#define L_ICAP_FRAMES 4372
#define L_TWTY_FRAME 8

twFrm = CreateObject("twFrame.twFrame.140")

oTwainCap.EnableMethodErrors = .F.
oTwainCap.CapInfo.Capability = L_TWUN_INCHES
oTwainCap.CapInfo.ConType = L_TWON_ONEVALUE
oTwainCap.CapOneValue.OneValItemType = L_TWTY_UINT16
#define VALUE_USHORT 4
CapVal = CreateObject("LEADRasterVariant.LEADRasterVariant.140")
CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWUN_INCHES
oTwainCap.CapOneValue.OneValCapValue = CapVal

twFrm.RightMargin = 0
twFrm.LeftMargin = 0
twFrm.BottomMargin = 10
twFrm.TopMargin = 10

oTwainCap.EnableMethodErrors = .F.
oTwainCap.CapInfo.Capability = L_ICAP_FRAMES
oTwainCap.CapInfo.ConType = L_TWON_ONEVALUE
oTwainCap.CapOneValue.OneValItemType = L_TWTY_FRAME
#define VALUE_DISPATCH 24
CapVal.Type = VALUE_DISPATCH
CapVal.DispatchValue = twFrm
oTwainCap.CapOneValue.OneValCapValue = CapVal

oRasterTwain.SetCapability2(oTwainCap, L_LTWAIN_CAPABILITY_SET)


SelectedFamilyName Example for Visual FoxPro 6

strMsg = "Source Name = " + oRasterTwain.SelectedSourceName + Chr(13) + ;
"Product Family Name = " + oRasterTwain.SelectedFamilyName + Chr(13) + ;
"Manufacturer Name = " + oRasterTwain.SelectedManufacturerName

MessageBox(strMsg)


SelectedSourceName Example for Visual FoxPro 6

MessageBox("The current selected source is: " + oRasterTwain.SelectedSourceName )


SelectSource Example for Visual FoxPro 6

nRet = oRasterTwain.SelectSource()
If nRet <> 0 Then
MessageBox("Error Selecting Source")
EndIf


ShowTemplateDlg Example for Visual FoxPro 6

oRasterTwain.ShowTemplateDlg("c:\test.ltt")


SourceName Example for Visual FoxPro 6

lCount = oRasterTwain.SourceCount
For n = 0 To lCount - 1
strName = oRasterTwain.SourceName(n)
MessageBox(strName)
&& Do More processing on source name
Next


UnlockSupport Example for Visual FoxPro 6

#define L_SUPPORT_DOCUMENT 0
If oRasterTwain.IsSupportLocked(L_SUPPORT_DOCUMENT) Then
oRasterTwain.UnlockSupport(L_SUPPORT_DOCUMENT, "TestKey")
EndIf


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
Online Support / FAQs: | http://www.leadtools.com (click on Customers Only)
Home page: | http://www.leadtools.com
FTP: | ftp.leadtools.com

You can also contact LEAD by mail at:

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

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


Error Codes

For a list of all possible error codes for LEADTOOLS Twain COM functions, refer to LEADTOOLS COM Error Codes in the Main COM help file.


Twain Properties, Methods and Events

Properties, Methods and Events

TWAIN Functionality

Session Functions

Application Functions

Capability Functions

Driver Settings

Template Functions

Margin Functions

TWAIN Source Functions

Image Functions

Fast TWAIN (Scan Configurations)

Getting or Setting TWAIN File System Information

JPEG Compression Functions

Miscellaneous Functions


TWAIN Functionality: Session Functions

TWAIN Functionality:
Session Functions

EndSession method

InitSession method


TWAIN Functionality: Application Functions

TWAIN Functionality:
Application Functions

AppName property

ManName property

ProdFamily property

Version property


TWAIN Functionality: Capability Functions

TWAIN Functionality:
Capability Functions

Low Level functionality:

MFC Properties and Methods

ArrayItemType property

ArrayCapValue property

ArrayNumOfItems property

Capability property (ICapability)

ConType property

EnumCapValue property

EnumCurrentIndex property

EnumDefaultIndex property

EnumItemType property

EnumNumOfItems property

GetCapability method

OneValCapValue property

OneValItemType property

RangeCurrentValue property

RangeDefaultValue property

RangeItemType property

RangeMaximumValue property

RangeMinimumValue property

RangeStepSize property

SetCapability method

Visual Basic Properties and Methods

ArrayItemType property (ICapabilityArray2 Interface)

ArrayCapValue property (ICapabilityArray2 Interface)

ArrayNumOfItems property (ICapabilityArray2 Interface)

Capability property (ICapability2 Interface)

CapabilityLong property (ICapability2 Interface)

CapArray property (ILEADTwainCapability)

CapEnum property (ILEADTwainCapability)

CapInfo property (ILEADTwainCapability)

CapOneValue property (ILEADTwainCapability)

CapRange property (ILEADTwainCapability)

ConType property (ICapability2 Interface)

EnumCapValue property (ICapabilityEnumeration2 Interface)

EnumCurrentIndex property (ICapabilityEnumeration2 Interface)

EnumDefaultIndex property (ICapabilityEnumeration2 Interface)

EnumItemType property (ICapabilityEnumeration2 Interface)

EnumNumOfItems property (ICapabilityEnumeration2 Interface)

GetCapability2 method

OneValCapValue property (ICapabilityOneValue2 Interface)

OneValItemType property (ICapabilityOneValue2 Interface)

RangeCurrentValue property (ICapabilityRange2 Interface)

RangeDefaultValue property (ICapabilityRange2 Interface)

RangeItemType property (ICapabilityRange2 Interface)

RangeMaximumValue property (ICapabilityRange2 Interface)

RangeMinimumValue property (ICapabilityRange2 Interface)

RangeStepSize property (ICapabilityRange2 Interface)

SetCapability2 method

High Level functionality:

Channel1 property

Channel2 property

Channel3 property

Index property

DuplexMode property

EnableDuplex property

GetTransferOptions method

ImageBitsPerPixel property

ImageBrightness property

ImageContrast property

ImageFrame property

ImageHighlight property

ImageUnit property

IsFileTransferAvailable property

IsMemoryTransferAvailable property

IsNativeTransferAvailable property

MaxXferCount property

PaperDirection property

PaperSize property

RGBElements property

RGBElementsCount property

SetRGBResponse method

SetTransferOptions method

ShowProgress method

TransferCompressionType property

TransferFileFormat property

TransferFileName property

TransferMode property

XResolution property

YResolution property

General Use Properties and Methods

Capability property (ILEADRasterTwain)

CapsCount property

QueryCapability method


TWAIN Functionality: Driver Settings

TWAIN Functionality:
Driver Settings

BitsPerPixel property

BottomMargin property

Brightness property

BufferMemoryCompression property

ColorScheme property

Contrast property

DataTransfer property

DuplexScanning property

EnableAppendToFile property

EnableAutoFeed property

EnableDumpMemoryBuffersToFile property

EnableSaveMultipageFile property

FillOrder property

GetProperties method

HalfTone property

HighLight property

HorizontalResolution property

ImageEffects property

ImageResolution property

LeftMargin property

MaxPagesNumber property

MemoryBufferSize property

PixelFlavor property

RightMargin property

RotationAngle property

ScanFileFormat property

SetProperties method

Shadow property

TopMargin property

TransferMode property

Unit property

VerticalResolution property

XScaling property

YScaling property


TWAIN Functionality: Template Functions

TWAIN Functionality:
Template Functions

EnableLoadTemplateEvent property

EnableSaveTemplateEvent property

EnableShowUserInterfaceOnly property

LoadTemplate method

LoadTemplateEvent event

LoadTemplateEvent2 event

SaveTemplate method

SaveTemplateEvent event

SaveTemplateEvent2 event

ShowTemplateDlg method


TWAIN Functionality: Margin Functions

TWAIN Functionality:
Margin Functions

BottomMargin property

LeftMargin property

RightMargin property

TopMargin property


TWAIN Functionality: TWAIN Source Functions

TWAIN Functionality:
TWAIN Source Functions

FamilyName property

ManufacturerName property

SelectedFamilyName property

SelectedManufacturerName property

SelectedSourceName property

SelectSource method

SourceCount property

SourceName property

AcquireSourceName property


TWAIN Functionality: Image Functions

TWAIN Functionality:
Image Functions

Acquire method

AcquireMulti method

AcquireMultiEvent event

AcquirePageEvent event

CondCode property

EnableAcquireMultiEvent Property

FastBitsPerPixel Property

FastBufferSize Property

FastFormat Property

FastTransferMode Property

FastUsePreferredBufferSize Property

FileTransferName property

GetExtImageInfo method

InfoID property

IsAvailable method

Item property

ItemType property

MemBufSize property

NumOfInfos property

NumOfItems property

PtwInfo property

StopFeedPages property


TWAIN Functionality: Fast TWAIN (Scan Configurations)

TWAIN Functionality:
Fast TWAIN (Scan Configurations)

BestFastConfig Property

BitsPerPixel Property

BufferSize Property

EnableFastConfigEvent Property

FastConfigEvent event

FastConfigsResult Property

FastConfigsResultCount Property

FileFormat Property

FindFastConfig method

GetScanConfigs method

RequiredTime Property

ScanConfig Property

ScanConfigCount Property

StopFindFastConfig Property

Success property

TransferMode Property

UserFastConfigs Property

UserFastConfigsCount Property


TWAIN Functionality: Miscellaneous Functions

TWAIN Functionality:
Miscellaneous Functions

EnableMethodErrors property


TWAIN Functionality: Getting or Setting TWAIN File System Information

TWAIN Functionality:
Getting or Setting TWAIN File System Information

QueryFileSystem method

FileSystemInfo property

InputName property

OutputName property

Recursive property

FileType property

FileSize property

CreateTimeDate property

ModifiedTimeDate property

FreeMediaSpace property

NewImageSize property

NumberOfFiles property

NumberOfAudioSnippets property

DeviceGroupMask property


TWAIN Functionality: JPEG Compression Functions

TWAIN Functionality:
JPEG Compression Functions

ColorSpace property

Data property

Flags property

GetJPEGCompression method

HuffmanAC property

HuffmanDC property

HuffmanMap property

JPEGCompressionData property

Length property

NumComponents property

QuantMap property

QuantTable property

RestartFrequency property

SetJPEGCompression method

SubSampling property


Capability property (ICapability Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short Capability
Overview | Refer to How to Work with the Containers - MFC.

Remarks

Gets or sets the capability constant that indicates the capability that is being retrieved or set.

For a list of available capability constants, refer to the LEADTOOLS TWAIN Defines.

See Also

Elements | ConType property.
Topics | TWAIN Functionality: Capability Functions


ConType property (ICapability Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short ConType
Overview | Refer to How to Work with the Containers - MFC.

Remarks

Gets or sets the container type used in getting or setting the capabilities values. Possible values are:

Value | Meaning
L_TWON_ONEVALUE | Container type is ICapabilityOneValue interface.
L_TWON_ENUMERATION | Container type is ICapabilityEnumeration interface.
L_TWON_ARRAY | Container type is ICapabilityArray interface.
L_TWON_RANGE | Container type is ICapabilityRange interface.

See Also

Elements | Capability property
Topics | TWAIN Functionality: Image Functions


Capability property (ICapability2 Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short Capability
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

Gets or sets the capability constant for the capability that is being retrieved or set when the capability constant is a short value. Use the CapabilityLong property to get or set a capability constant that is a long value.

For a list of available capability constants, refer to the LEADTOOLS TWAIN Defines.

See Also

Elements | ConType property, CapabilityLong property
Topics | TWAIN Functionality: Capability Functions


CapabilityLong property (ICapability2 Interface)

Visual Basic Example

Syntax | long CapabilityLong
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

Gets or sets the capability constant for the capability that is being retrieved or set when the capability constant is a long value. Use the Capability property to get or set a capability constant that is a short value.

For a list of available capability constants, refer to the LEADTOOLS TWAIN Defines.

See Also

Elements | ConType property, Capability property, CapInfo property.
Topics | TWAIN Functionality: Capability Functions


ConType property (ICapability2 Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short ConType
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

Gets or sets the container type used in getting or setting the capabilities values. Possible values are:

Value | Meaning
L_TWON_ONEVALUE | Container type is ICapabilityOneValue2 interface.
L_TWON_ENUMERATION | Container type is ICapabilityEnumeration2 interface.
L_TWON_ARRAY | Container type is ICapabilityArray2 interface.
L_TWON_RANGE | Container type is ICapabilityRange2 interface.
L_TWON_DONTCARE16 | Container type is unimportant. This is often used to set this property before getting a capability.

See Also

Elements | Capability property, CapabilityLong property
Topics | TWAIN Functionality: Image Functions
 | TWAIN Functionality: Capability Functions


ArrayCapValue property (ICapabilityArray Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILEADRasterVariant * ArrayCapValue (long nIndex)
Overview | Refer to How to Work with the Containers - MFC.

Remarks

An ILEADRasterVariant object that contains the value of the ICapabilityArray interface, where the ICapabilityArray interface represents a container of type TW_ARRAY.

When getting capability information, this property contains the values for the TW_ARRAY container associated with the capability. When setting a capability, this property should contain the values for the TW_ARRAY container to set.

See Also

Elements | ArrayItemType property, ArrayNumOfItems property.
Topics | TWAIN Functionality: Capability Functions


ArrayItemType property (ICapabilityArray Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long ArrayItemType
Overview | Refer to How to Work with the Containers - MFC.

Remarks

Get or sets type of data contained in the ICapabilityArray interface, where the ICapabilityArray interface represents a container of type TW_ARRAY. For a list of possible values, refer to the LEADTOOLS TWAIN Defines.

When getting capability information, this property contains the type of items contained in the TW_ARRAY container associated with the capability. When setting a capability, this property should contain the type of items to be set in the TW_ARRAY container.

See Also

Elements | ArrayCapValue property, ArrayNumOfItems property.
Topics | TWAIN Functionality: Capability Functions


ArrayNumOfItems property (ICapabilityArray Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long ArrayNumOfItems
Overview | Refer to How to Work with the Containers - MFC.

Remarks

Get or sets the number of items in the array of the ICapabilityArray interface, where the ICapabilityArray interface represents a container of type TW_ARRAY.

When getting capability information, this property contains the number of items contained in the array of the TW_ARRAY container associated with the capability. When setting a capability, this property should contain the number of items in the array to be set in the TW_ARRAY container.

See Also

Elements | ArrayItemType property, ArrayCapValue property.
Topics | TWAIN Functionality: Capability Functions


ArrayCapValue property (ICapabilityArray2 Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILEADRasterVariant * ArrayCapValue (long nIndex)
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

An ILEADRasterVariant object that contains the value of the ICapabilityArray2 interface, where the ICapabilityArray2 interface represents a container of type TW_ARRAY.

When getting capability information, this property contains the values for the TW_ARRAY container associated with the capability. When setting a capability, this property should contain the values for the TW_ARRAY container to set.

See Also

Elements | ArrayItemType property, ArrayNumOfItems property.
Topics | TWAIN Functionality: Capability Functions


ArrayItemType property (ICapabilityArray2 Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short ArrayItemType
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

Get or sets the type of data contained in the ICapabilityArray2 interface, where the ICapabilityArray2 interface represents a container of type TW_ARRAY. For a list of possible values, refer to the LEADTOOLS TWAIN Defines.

When getting capability information, this property contains the type of items contained in the TW_ARRAY container associated with the capability. When setting a capability, this property should contain the type of items to be set in the TW_ARRAY container.

See Also

Elements | ArrayCapValue property, ArrayNumOfItems property.
Topics | TWAIN Functionality: Capability Functions


ArrayNumOfItems property (ICapabilityArray2 Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long ArrayNumOfItems
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

Get or sets the number of items in the array of the ICapabilityArray2 interface, where the ICapabilityArray2 interface represents a container of type TW_ARRAY.

When getting capability information, this property contains the number of items contained in the array of the TW_ARRAY container associated with the capability. When setting a capability, this property should contain the number of items in the array to be set in the TW_ARRAY container.

See Also

Elements | ArrayItemType property, ArrayCapValue property.
Topics | TWAIN Functionality: Capability Functions


EnumCapValue property (ICapabilityEnumeration Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILEADRasterVariant *EnumCapValue (long nIndex)
Overview | Refer to How to Work with the Containers - MFC.

Remarks

An ILEADRasterVariant object that contains the value of the ICapabilityEnumeration interface, where the ICapabilityEnumeration interface represents a container of type TW_ENUMERATION.

When getting capability information, this property contains the values for the TW_ENUMERATION container associated with the capability. When setting a capability, this property should contain the values for the TW_ENUMERATION container to set.

See Also

Elements | EnumItemType property, EnumNumOfItems property, EnumCurrentIndex property, EnumDefaultIndex property.
Topics | TWAIN Functionality: Capability Functions


EnumCurrentIndex property (ICapabilityEnumeration Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long EnumCurrentIndex
Overview | Refer to How to Work with the Containers - MFC.

Remarks

Get or sets the index of the current value in the enumeration item list contained in the ICapabilityEnumeration interface, where the ICapabilityEnumeration interface represents a container of type TW_ENUMERATION.

When getting capability information, this property contains the index of the current value in the enumeration item list in the TW_ENUMERATION container associated with the capability. When setting a capability, this property should contain the index of the current value in the enumeration item list to be set in the TW_ENUMERATION container.

This index can be passed to the EnumCapValue property to get the actual value in the enumeration item list.

See Also

Elements | EnumItemType property, EnumCapValue property, EnumNumOfItems property, EnumDefaultIndex property.
Topics | TWAIN Functionality: Capability Functions


EnumDefaultIndex property (ICapabilityEnumeration Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long EnumDefaultIndex
Overview | Refer to How to Work with the Containers - MFC.

Remarks

Get or sets the index of the default value in the enumeration item list contained in the ICapabilityEnumeration interface, where the ICapabilityEnumeration interface represents a container of type TW_ENUMERATION.

When getting capability information, this property contains the index of the default value in the enumeration item list in the TW_ENUMERATION container associated with the capability. When setting a capability, this property should contain the index of the default value in the enumeration item list to be set in the TW_ENUMERATION container.

This index can be passed to the EnumCapValue property to get the actual value in the enumeration item list.

See Also

Elements | EnumItemType property, EnumCapValue property, EnumNumOfItems property, EnumCurrentIndex property.
Topics | TWAIN Functionality: Capability Functions


EnumItemType property (ICapabilityEnumeration Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short EnumItemType
Overview | Refer to How to Work with the Containers - MFC.

Remarks

Get or sets type of data contained in the ICapabilityEnumeration interface, where the ICapabilityEnumeration interface represents a container of type TW_ENUMERATION. For a list of possible values, refer to the LEADTOOLS TWAIN Defines.

When getting capability information, this property contains the data type of items contained in the TW_ENUMERATION container associated with the capability. When setting a capability, this property should contain the type of items to be set in the TW_ENUMERATION container.

See Also

Elements | EnumCapValue property, EnumNumOfItems property, EnumCurrentIndex property, EnumDefaultIndex property.
Topics | TWAIN Functionality: Capability Functions


EnumNumOfItems property (ICapabilityEnumeration Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long EnumNumOfItems
Overview | Refer to How to Work with the Containers - MFC.

Remarks

Gets or sets the number of values of a certain capability in the enumeration.

Get or sets the number of items in the array of the ICapabilityEnumeration interface, where the ICapabilityEnumeration interface represents a container of type TW_ENUMERATION.

When getting capability information, this property contains the number of items contained in the array of the TW_ENUMERATION container associated with the capability. When setting a capability, this property should contain the number of items in the array to be set in the TW_ENUMERATION container.

See Also

Elements | EnumItemType property, EnumCapValue property, EnumCurrentIndex property, EnumDefaultIndex property.
Topics | TWAIN Functionality: Capability Functions


EnumCapValue property (ICapabilityEnumeration2 Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILEADRasterVariant *EnumCapValue (long nIndex)
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

An ILEADRasterVariant object that contains the value of the ICapabilityEnumeration2 interface, where the ICapabilityEnumeration2 interface represents a container of type TW_ENUMERATION.

When getting capability information, this property contains the values for the TW_ENUMERATION container associated with the capability. When setting a capability, this property should contain the values for the TW_ENUMERATION container to set.

See Also

Elements | EnumItemType property, EnumNumOfItems property, EnumCurrentIndex property, EnumDefaultIndex property.
Topics | TWAIN Functionality: Capability Functions


EnumCurrentIndex property (ICapabilityEnumeration2 Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long EnumCurrentIndex
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

Get or sets the index of the current value in the enumeration item list contained in the ICapabilityEnumeration2 interface, where the ICapabilityEnumeration2 interface represents a container of type TW_ENUMERATION.

When getting capability information, this property contains the index of the current value in the enumeration item list in the TW_ENUMERATION container associated with the capability. When setting a capability, this property should contain the index of the current value in the enumeration item list to be set in the TW_ENUMERATION container.

This index can be passed to the EnumCapValue property to get the actual value in the enumeration item list.

See Also

Elements | EnumItemType property, EnumCapValue property, EnumNumOfItems property, EnumDefaultIndex property.
Topics | TWAIN Functionality: Capability Functions


EnumDefaultIndex property (ICapabilityEnumeration2 Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long EnumDefaultIndex
Overview | Refer to How to Work with the Containers –Visual Basic.

Remarks

Get or sets the index of the default value in the enumeration item list contained in the ICapabilityEnumeration2 interface, where the ICapabilityEnumeration2 interface represents a container of type TW_ENUMERATION.

When getting capability information, this property contains the index of the default value in the enumeration item list in the TW_ENUMERATION container associated with the capability. When setting a capability, this property should contain the index of the default value in the enumeration item list to be set in the TW_ENUMERATION container.

This index can be passed to the EnumCapValue property to get the actual value in the enumeration item list.

See Also

Elements | EnumItemType property, EnumCapValue property, EnumNumOfItems property, EnumCurrentIndex property.
Topics | TWAIN Functionality: Capability Functions


EnumItemType property (ICapabilityEnumeration2 Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short EnumItemType
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

Get or sets the type of data contained in the ICapabilityEnumeration2 interface, where the ICapabilityEnumeration2 interface represents a container of type TW_ENUMERATION. For a list of possible values, refer to the LEADTOOLS TWAIN Defines.

When getting capability information, this property contains the data type of items contained in the TW_ENUMERATION container associated with the capability. When setting a capability, this property should contain the type of items to be set in the TW_ENUMERATION container.

See Also

Elements | EnumCapValue property, EnumNumOfItems property, EnumCurrentIndex property, EnumDefaultIndex property.
Topics | TWAIN Functionality: Capability Functions


EnumNumOfItems property (ICapabilityEnumeration2 Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long EnumNumOfItems
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

Get or sets the number of items in the array of the ICapabilityEnumeration2 interface, where the ICapabilityEnumeration2 interface represents a container of type TW_ENUMERATION.

When getting capability information, this property contains the number of items contained in the array of the TW_ENUMERATION container associated with the capability. When setting a capability, this property should contain the number of items in the array to be set in the TW_ENUMERATION container.

See Also

Elements | EnumItemType property, EnumCapValue property, EnumCurrentIndex property, EnumDefaultIndex property.
Topics | TWAIN Functionality: Capability Functions


OneValCapValue property (ICapabilityOneValue Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILEADRasterVariant * OneValCapValue
Overview | Refer to How to Work with the Containers - MFC.

Remarks

An ILEADRasterVariant object that contains the value of the ICapabilityOneValue interface, where the ICapabilityOneValue interface represents a container of type TW_ONEVALUE.

When getting capability information, this property contains the value for the TW_ONEVALUE container associated with the capability. When setting a capability, this property should contain the value for the TW_ONEVALUE container to set.

See Also

Elements | OneValItemType property
Topics | TWAIN Functionality: Capability Functions


OneValItemType property (ICapabilityOneValue Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short OneValItemType
Overview | Refer to How to Work with the Containers - MFC.

Remarks

Get or sets type of data contained in the ICapabilityOneValue interface, where the ICapabilityOneValue interface represents a container of type TW_ONEVALUE. For a list of possible values, refer to the LEADTOOLS TWAIN Defines.

When getting capability information, this property contains the type of item contained in the TW_ONEVALUE container associated with the capability. When setting a capability, this property should contain the type of item to be set in the TW_ONEVALUE container.

See Also

Elements | OneValCapValue property.
Topics | TWAIN Functionality: Capability Functions


RangeCurrentValue property (ICapabilityRange Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILEADRasterVariant * RangeCurrentValue
Overview | Refer to How to Work with the Containers - MFC.

Remarks

Get or sets the current value in the range contained in the ICapabilityRange interface, where the ICapabilityRange interface represents a container of type TW_RANGE.

When getting capability information, this property contains the current value in the range in the TW_RANGE container associated with the capability. When setting a capability, this property should contain the current value in the range to be set in the TW_RANGE container.

See Also

Elements | RangeItemType property, RangeDefaultValue property, RangeMinimumValue property, RangeMaximumValue property, RangeStepSize property.
Topics | TWAIN Functionality: Capability Functions


RangeDefaultValue property (ICapabilityRange Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILEADRasterVariant * RangeDefaultValue
Overview | Refer to How to Work with the Containers - MFC.

Remarks

Gets or sets a certain capability default value in the range container.

Get or sets the default value in the range contained in the ICapabilityRange interface, where the ICapabilityRange interface represents a container of type TW_RANGE.

When getting capability information, this property contains the default value in the range in the TW_RANGE container associated with the capability. When setting a capability, this property should contain the default value in the range to be set in the TW_RANGE container.

See Also

Elements | RangeItemType property, RangeCurrentValue property, RangeMinimumValue property, RangeMaximumValue property, RangeStepSize property.
Topics | TWAIN Functionality: Capability Functions


RangeItemType property (ICapabilityRange Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short RangeItemType
Overview | Refer to How to Work with the Containers - MFC.

Remarks

Get or sets type of data contained in the ICapabilityRange interface, where the ICapabilityRange interface represents a container of type TW_RANGE. For a list of possible values, refer to the LEADTOOLS TWAIN Defines.

When getting capability information, this property contains the data type of items contained in the TW_RANGE container associated with the capability. When setting a capability, this property should contain the type of items to be set in the TW_RANGE container.

See Also

Elements | RangeCurrentValue property, RangeDefaultValue property, RangeMinimumValue property, RangeMaximumValue property, RangeStepSize property.
Topics | TWAIN Functionality: Capability Functions


RangeMaximumValue property (ICapabilityRange Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILEADRasterVariant * RangeMaximumValue
Overview | Refer to How to Work with the Containers - MFC.

Remarks

Get or sets the maximum value in the range contained in the ICapabilityRange interface, where the ICapabilityRange interface represents a container of type TW_RANGE.

When getting capability information, this property contains maximum value in the range in the TW_RANGE container associated with the capability. When setting a capability, this property should contain the maximum value in the range to be set in the TW_RANGE container.

See Also

Elements | RangeItemType property, RangeCurrentValue property, RangeDefaultValue property, RangeMinimumValue property, RangeStepSize property.
Topics | TWAIN Functionality: Capability Functions


RangeMinimumValue property (ICapabilityRange Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILEADRasterVariant * RangeMinimumValue
Overview | Refer to How to Work with the Containers - MFC.

Remarks

Get or sets the minimum value in the range contained in the ICapabilityRange interface, where the ICapabilityRange interface represents a container of type TW_RANGE.

When getting capability information, this property contains minimum value in the range in the TW_RANGE container associated with the capability. When setting a capability, this property should contain the minimum value in the range to be set in the TW_RANGE container.

See Also

Elements | RangeItemType property, RangeCurrentValue property, RangeDefaultValue property, RangeMaximumValue property, RangeStepSize property.
Topics | TWAIN Functionality: Capability Functions


RangeStepSize property (ICapabilityRange Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILEADRasterVariant * RangeStepSize
Overview | Refer to How to Work with the Containers - MFC.

Remarks

Get or sets the step size contained in the ICapabilityRange interface, where the ICapabilityRange interface represents a container of type TW_RANGE.

When getting capability information, this property contains the step size in the TW_RANGE container associated with the capability. When setting a capability, this property should contain the step size to be set in the TW_RANGE container.

The step size is the amount of increase from one step to the next within the range RangeMinimumValue property to RangeMaximumValue property. For example, if the value of the RangeMinimumValue property = 0, the value of the RangeMaximumValue property = 100, and the value of RangeStepSize property = 2, then it will take 50 steps to increase from 0 to 100.

See Also

Elements | RangeItemType property, RangeCurrentValue property, RangeDefaultValue property, RangeMinimumValue property, RangeMaximumValue property.
Topics | TWAIN Functionality: Capability Functions


OneValCapValue property (ICapabilityOneValue2 Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILEADRasterVariant *OneValCapValue
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

An ILEADRasterVariant object that contains the value of the ICapabilityOneValue2 interface, where the ICapabilityOneValue2 interface represents a container of type TW_ONEVALUE.

When getting capability information, this property contains the value for the TW_ONEVALUE container associated with the capability. When setting a capability, this property should contain the value for the TW_ONEVALUE container to set.

See Also

Elements | OneValItemType property
Topics | TWAIN Functionality: Capability Functions


OneValItemType property (ICapabilityOneValue2 Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short OneValItemType
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

Get or sets type of data contained in the ICapabilityOneValue2 interface, where the ICapabilityOneValue2 interface represents a container of type TW_ONEVALUE. For a list of possible values, refer to the LEADTOOLS TWAIN Defines.

When getting capability information, this property contains the type of item contained in the TW_ONEVALUE container associated with the capability. When setting a capability, this property should contain the type of item to be set in the TW_ONEVALUE container.

See Also

Elements | OneValCapValue property.
Topics | TWAIN Functionality: Capability Functions


RangeCurrentValue property (ICapabilityRange2 Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILEADRasterVariant * RangeCurrentValue
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

Get or sets the current value in the range contained in the ICapabilityRange2 interface, where the ICapabilityRange2 interface represents a container of type TW_RANGE.

When getting capability information, this property contains the current value in the range in the TW_RANGE container associated with the capability. When setting a capability, this property should contain the current value in the range to be set in the TW_RANGE container.

See Also

Elements | RangeItemType property, RangeDefaultValue property, RangeMinimumValue property, RangeMaximumValue property, RangeStepSize property.
Topics | TWAIN Functionality: Capability Functions


RangeDefaultValue property (ICapabilityRange2 Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILEADRasterVariant * RangeDefaultValue
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

Get or sets the default value in the range contained in the ICapabilityRange2 interface, where the ICapabilityRange2 interface represents a container of type TW_RANGE.

When getting capability information, this property contains the default value in the range in the TW_RANGE container associated with the capability. When setting a capability, this property should contain the default value in the range to be set in the TW_RANGE container.

See Also

Elements | RangeItemType property, RangeCurrentValue property, RangeMinimumValue property, RangeMaximumValue property, RangeStepSize property.
Topics | TWAIN Functionality: Capability Functions


RangeItemType property (ICapabilityRange2 Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short RangeItemType
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

Get or sets type of data contained in the ICapabilityRange2 interface, where the ICapabilityRange2 interface represents a container of type TW_RANGE. For a list of possible values, refer to the LEADTOOLS TWAIN Defines.

When getting capability information, this property contains the data type of items contained in the TW_RANGE container associated with the capability. When setting a capability, this property should contain the type of items to be set in the TW_RANGE container.

See Also

Elements | RangeCurrentValue property, RangeDefaultValue property, RangeMinimumValue property, RangeMaximumValue property, RangeStepSize property.
Topics | TWAIN Functionality: Capability Functions


RangeMaximumValue property (ICapabilityRange2 Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILEADRasterVariant * RangeMaximumValue
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

Get or sets the maximum value in the range contained in the ICapabilityRange2 interface, where the ICapabilityRange2 interface represents a container of type TW_RANGE.

When getting capability information, this property contains maximum value in the range in the TW_RANGE container associated with the capability. When setting a capability, this property should contain the maximum value in the range to be set in the TW_RANGE container.

See Also

Elements | RangeItemType property, RangeCurrentValue property, RangeDefaultValue property, RangeMinimumValue property, RangeStepSize property.
Topics | TWAIN Functionality: Capability Functions


RangeMinimumValue property (ICapabilityRange2 Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILEADRasterVariant * RangeMinimumValue
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

Get or sets the minimum value in the range contained in the ICapabilityRange2 interface, where the ICapabilityRange2 interface represents a container of type TW_RANGE.

When getting capability information, this property contains the minimum value in the range in the TW_RANGE container associated with the capability. When setting a capability, this property should contain the minimum value in the range to be set in the TW_RANGE container.

See Also

Elements | RangeItemType property, RangeCurrentValue property, RangeDefaultValue property, RangeMaximumValue property, RangeStepSize property.
Topics | TWAIN Functionality: Capability Functions


RangeStepSize property (ICapabilityRange2 Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILEADRasterVariant * RangeStepSize
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

Get or sets the step size contained in the ICapabilityRange2 interface, where the ICapabilityRange2 interface represents a container of type TW_RANGE.

When getting capability information, this property contains the step size in the TW_RANGE container associated with the capability. When setting a capability, this property should contain the step size to be set in the TW_RANGE container.

The step size is the amount of increase from one step to the next within the range RangeMinimumValue property to RangeMaximumValue property. For example, if the value of the RangeMinimumValue property = 0, the value of the RangeMaximumValue property = 100, and the value of RangeStepSize property = 2, then it will take 50 steps to increase from 0 to 100.

See Also

Elements | RangeItemType property, RangeCurrentValue property, RangeDefaultValue property, RangeMinimumValue property, RangeMaximumValue property.
Topics | TWAIN Functionality: Capability Functions


AcquireSourceName property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | BSTR AcquireSourceName
Overview | Refer to Managing the TWAIN Source.

Remarks

This property will be used to set the source name in case the select source procedure is to be done without showing a user interface.

This value has to be set to a valid source name. You can get all available source names using the SourceName property.

This property is a write only property.

See Also

Elements | SourceName property, SourceCount property.
Topics | TWAIN Functionality: TWAIN Source Functions


AppName property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | BSTR AppName
Overview | Refer to Initializing a TWAIN Session.

Remarks

(Write only) An application specific string that contains the user's application name. Using this property is optional.

See Also

Elements | ManName property, ProdFamily property, Version property.
Topics | TWAIN Functionality: Application Functions


BestFastConfig Property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILTFastConfig * BestFastConfig
Overview | Refer to Fast TWAIN (Scan Configurations)

Remarks

(Read only) Gets the best and fastest scan configuration for the Twain scanner selected using the SelectSource method.

This property is updated by the FindFastConfig method.

The BestFastConfig object has the properties listed below. For more information on each sub-property, follow the appropriate link.

Property | Type | Description
BitsPerPixel property (ILTFastConfig) | short | Bits per pixel of the scan configuration
BufferSize property (ILTFastConfig) | long | Buffer size of the scan configuration
FileFormat property (ILTFastConfig) | short | File format of the scan configuration
RequiredTime property (ILTFastConfig) | long | Amount of time to scan the test pages for the scan configuration
TransferMode property (ILTFastConfig) | short | Transfer mode of the scan configuration

See Also

Elements | EnableFastConfigEvent property, UserFastConfigs property, UserFastConfigsCount property, FastConfigsResult property, FastConfigsResultCount property, FindFastConfig method, StopFindFastConfig property, FastConfigEvent event
Topics | Twain Functionality: Fast TWAIN (Scan Configurations)


BottomMargin property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | float BottomMargin
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the value of the bottom margin of the scanning area.

The unit of measure for this property is determined by the Unit property.

This property is equivalent to the ICAP_FRAMES capability. There are two ways of determining the possible values for this capability:

call the QueryCapability method with pCapability. Capability set to ICAP_FRAMES.

call the GetCapability method (MFC) or the GetCapability2 method (VB) with pCapability. Capability set to ICAP_FRAMES and the IFlags parameter set to L_LTWAIN_CAPABILITY_GETVALUES.

For more information on specific TWAIN capabilities, refer to the TWAIN 1.9 specification.

This property is updated with the driver’s current value by calling the GetProperties method.

To set a new bottom margin value to the TWAIN driver, assign a new value to this property and call the SetProperties method.

See Also

Elements | ImageEffects property, DataTransfer property, ImageResolution property, EnableAutoFeed property, MaxPagesNumber property, DuplexScanning property, GetProperties method, SetProperties method, LeftMargin property, RightMargin property, TopMargin property, Unit property, GetCapability method, GetCapability2 method, QueryCapability method
Topics | TWAIN Functionality: Driver Settings


Capability property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long Capability (long nIndex)
Overview | Refer to Getting and Setting Capabilities.

Remarks

(Read only) Contains the array of capabilities supported by the currently selected TWAIN source.

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: Capability Functions


CapsCount property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long CapsCount
Overview | Refer to Getting and Setting Capabilities.

Remarks

(Read only) Contains the number of capabilities supported by the currently selected TWAIN source.

This property is updated when the SelectSource method is called.

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: Capability Functions


DataTransfer property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILTDataTransfer * DataTransfer
Overview | Refer to Getting and Setting Capabilities.

Remarks

(Read Only) Gets the image data transfer properties for the current data source.

This ILTDataTransfer object contains the following properties:

BufferMemoryCompression property

EnableAppendToFile property

EnableDumpMemoryBuffersToFile property

EnableSaveMultipageFile property

FillOrder property

MemoryBufferSize property

ScanFileFormat property

TransferMode property

The above properties are updated by calling the GetProperties method.

The DataTransfer property itself is read only. However, the properties accessed by this property can be set with new data transfer values. To set these values to the TWAIN driver, call the SetProperties method.

See Also

Elements | ImageEffects property, ImageResolution property, EnableAutoFeed property, MaxPagesNumber property, DuplexScanning property, GetProperties method, SetProperties method, LeftMargin property, RightMargin property, TopMargin property, BottomMargin property, FillOrder property, BufferMemoryCompression property, TransferMode property, ScanFileFormat property, MemoryBufferSize property, EnableSaveMultipageFile property, EnableAppendToFile property, EnableDumpMemoryBuffersToFile property
Topics | TWAIN Functionality: Driver Settings


DuplexMode property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | short DuplexMode
Overview | Refer to Getting and Setting Capabilities

Remarks

(Read only) Gets duplex mode value.

This property internally gets the duplex capability CAP_DUPLEX. For more information on this capability, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


DuplexScanning property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long DuplexScanning
Overview | Refer to Getting and Setting Capabilities.

Remarks

(Read only) Gets the type of duplex scanning that the TWAIN source supports, if the TWAIN source supports duplex scanning. Possible values are (according to the TWAIN 1.9 specification):

Value | Meaning
L_TWDX_NONE | No duplex used.
L_TWDX_1PASSDUPLEX | 1 pass duplex.
L_TWDX_2PASSDUPLEX | 2 pass duplex.

To update the value of this property, call the GetProperties method.

The value of the DuplexScanning property is defined by the TWAIN source and is retrieved from the TWAIN driver. As such, the programmer cannot alter this property.

See Also

Elements | ImageEffects property, DataTransfer property, ImageResolution property, EnableAutoFeed property, MaxPagesNumber property, GetProperties method, SetProperties method, LeftMargin property, RightMargin property, TopMargin property, BottomMargin property
Topics | TWAIN Functionality: Driver Settings


EnableAcquireMultiEvent Property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | VARIANT_BOOL EnableAcquireMultiEvent
Overview | Refer to How to Acquire from the Twain Source.

Remarks

Enables or disables the generation of the AcquireMultiEvent event. Possible values are:

Setting | Description
TRUE | Enable the generation of the AcquireMultiEvent event.
FALSE | Disable the generation of the AcquireMultiEvent event.

See Also

Elements | AcquireMultiEvent event, FastTransferMode property, FastFormat property, FastBitsPerPixel property, FastBufferSize property, FastUsePreferredBufferSize property
Topics | Fast TWAIN (Scan Configurations)


EnableAutoFeed property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | VARIANT_BOOL EnableAutoFeed
Overview | Refer to Getting and Setting Capabilities

Remarks

Enables or disables the use of Auto-Feed capability of the selected TWAIN source. Possible values are:

Setting | Description
TRUE | Enables the Auto-Feed capability usage.
FALSE | Disables the Auto-Feed capability usage.

To update this property with the current value, call the GetProperties method.

To set the EnableAutoFeed value to the TWAIN driver, assign a new value to this property and call the SetProperties method.

See Also

Elements | ImageEffects property, DataTransfer property, ImageResolution property, MaxPagesNumber property, DuplexScanning property, GetProperties method, SetProperties method, LeftMargin property, RightMargin property, TopMargin property, BottomMargin property
Topics | TWAIN Functionality: Driver Settings


EnableDuplex property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | VARIANT_BOOL EnableDuplex
Overview | Refer to Getting and Setting Capabilities

Remarks

Enables or disables the duplex mode. Possible values are:

Value | Meaning
TRUE | Enables the duplex mode.
FALSE | Disables the duplex mode.

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

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


EnableFastConfigEvent Property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | VARIANT_BOOL EnableFastConfigEvent
Overview | Refer to Fast TWAIN (Scan Configurations)

Remarks

Enables or disables the generation of the FastConfigEvent event. Possible values are:

Setting | Description
TRUE | Enable the generation of the FastConfigEvent event.
FALSE | Disable the generation of the FastConfigEvent event.

See Also

Elements | UserFastConfigs property, UserFastConfigsCount property, FastConfigsResult property, FastConfigsResultCount property, BestFastConfig property, FindFastConfig method, StopFindFastConfig property, FastConfigEvent event
Topics | Twain Functionality: Fast TWAIN (Scan Configurations)


EnableLoadTemplateEvent Property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | VARIANT_BOOL EnableLoadTemplateEvent
Overview | Refer to Handling Template Files

Remarks

Enables or disables the generation of the LoadTemplateEvent2 event. Possible values are:

Setting | Description
TRUE | Enable the generation of the LoadTemplateEvent2 event.
FALSE | Disable the generation of the LoadTemplateEvent2 event.

See Also

Elements | LoadTemplateEvent2 event, LoadTemplate method, SaveTemplateEvent2 event, SaveTemplate method, EnableSaveTemplateEvent property
Topics | Twain Functionality: Template Functions


EnableMethodErrors property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | BOOL EnableMethodErrors
Overview | Refer to Initializing a TWAIN Session

Remarks

(Persistent property, available at design time) Specifies whether LEADTOOLS generates system error events (in addition to error return codes).

Setting | Description
TRUE | Generates system error events.
FALSE | Does not generate system error events.


EnableSaveTemplateEvent Property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | VARIANT_BOOL EnableSaveTemplateEvent
Overview | Refer to Handling Template Files

Remarks

Enables or disables the generation of the SaveTemplateEvent2 event. Possible values are:

Setting | Description
TRUE | Enable the generation of the SaveTemplateEvent2 event.
FALSE | Disable the generation of the SaveTemplateEvent2 event.

See Also

Elements | SaveTemplateEvent2 event, SaveTemplate method, LoadTemplateEvent2 event, LoadTemplate method, EnableLoadTemplateEvent property
Topics | Twain Functionality: Template Functions


EnableShowUserInterfaceOnly Property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | VARIANT_BOOL EnableShowUserInterfaceOnly
Overview | Refer to Handling Template Files

Remarks

Gets or sets a value that indicates whether to display the Twain user interface with a scan button or without. Possible values are:

Setting | Description
TRUE | Display the Twain user interface without the scan button, if supported.
FALSE | Display the normal Twain driver user interface with the scan button. (Default).

See Also

Elements | ShowTemplateDlg method
Topics | Twain Functionality: Template Functions


FamilyName property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | BSTR FamilyName(long nIndex)
Overview | Refer to Managing the TWAIN Source.

Remarks

(Read only) Gets a character string that contains the family product name of the specified TWAIN source. This name is provided by the manufacturer.

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property, ManufacturerName property, SelectedFamilyName property, SelectedManufacturerName property
Topics | TWAIN Functionality: TWAIN Source Functions.


FastBitsPerPixel Property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long FastBitsPerPixel
Overview | Refer to How to Acquire from the TWAIN Source.

Remarks

Gets or sets the bits per pixel for the output file. Images scanned using the AcquireMulti method will be saved to a file using the bits per pixel value set in this property.

Note that not all bits per pixel are available to all file formats. For valid values, refer to Formats of Output Files . If value of this property is 0, the file will be stored using the closet BitsPerPixel value supported by that format.

See Also

Elements | FastTransferMode property, FastFormat property, FastBufferSize property, FastUsePreferredBufferSize property, AcquireMulti method
Topics | TWAIN Functionality: Image Functions


FastBufferSize Property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long FastBufferSize
Overview | Refer to How to Acquire from the TWAIN Source.

Remarks

Gets or sets the custom (user-defined) buffer size. This value will be used if the FastTransferMode property is set to L_LTWAIN_BUFFER_MODE and FastUsePreferredBufferSize property is set to FALSE.

This value must be a multiple of 16.

For more information on buffer size versus buffer iteration, refer to the Remarks section of the FindFastConfig method.

See Also

Elements | FastTransferMode property, FastFormat property, FastBitsPerPixel property, FastUsePreferredBufferSize property, AcquireMulti method
Topics | TWAIN Functionality: Image Functions


FastConfigsResult Property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILTFastConfig * FastConfigsResult(short iIndex)
Overview | Refer to Fast TWAIN (Scan Configurations)

Remarks

(Read only) Gets the scan configurations tested by the FindFastConfig method.

The number of scan configurations tested can be found in the FastConfigsResultCount property.

See Also

Elements | EnableFastConfigEvent property, UserFastConfigs property, UserFastConfigsCount property, FastConfigsResultCount property, BestFastConfig property, FindFastConfig method, StopFindFastConfig property, FastConfigEvent event
Topics | Twain Functionality: Fast TWAIN (Scan Configurations)


FastConfigsResultCount Property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short FastConfigsResultCount
Overview | Refer to Fast TWAIN (Scan Configurations)

Remarks

(Read only) Gets the number of scan configurations tested by the FindFastConfig method. The actual scan configurations that were tested can be found in the FastConfigsResult property.

See Also

Elements | EnableFastConfigEvent property, UserFastConfigs property, UserFastConfigsCount property, FastConfigsResult property, BestFastConfig property, FindFastConfig method, StopFindFastConfig property, FastConfigEvent event
Topics | Twain Functionality: Fast TWAIN (Scan Configurations)


FastFormat Property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long FastFormat
Overview | Refer to How to Acquire from the TWAIN Source.

Remarks

Gets or sets the output file format. Images scanned using the AcquireMulti method will be saved using this file format. For valid values, refer to Formats of Output Files .

See Also

Elements | FastTransferMode property, FastBitsPerPixel property, FastBufferSize property, FastUsePreferredBufferSize property, AcquireMulti method
Topics | TWAIN Functionality: Image Functions


FastTransferMode Property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long FastTransferMode
Overview | Refer to How to Acquire from the TWAIN Source.

Remarks

Gets or sets the transfer mode used to acquire images with the AcquireMulti method. Possible values are:

Value | Meaning
L_LTWAIN_FILE_MODE | [0x001] Use the File transfer mode.
L_LTWAIN_BUFFER_MODE | [0x002] Use the Memory transfer mode.
L_LTWAIN_NATIVE_MODE | [0x004] Use the Native transfer mode.

See Also

Elements | FastFormat property, FastBitsPerPixel property, FastBufferSize property, FastUsePreferredBufferSize property, AcquireMulti method
Topics | TWAIN Functionality: Image Functions


FastUsePreferredBufferSize Property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | VARIANT_BOOL FastUsePreferredBufferSize
Overview | Refer to How to Acquire from the TWAIN Source.

Remarks

Enables or disables using the Twain driver preferred buffer size. Possible values are:

Setting | Description
TRUE | Use the preferred buffer size specified by the TWAIN driver.
FALSE | Use the user-defined buffer size in the FastBufferSize property.

See Also

Elements | FastTransferMode property, FastFormat property, FastBitsPerPixel property, FastBufferSize property, AcquireMulti method
Topics | TWAIN Functionality: Image Functions


FileSystemInfo property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | IFileSystem * FileSystemInfo
Overview | Refer to Getting or Setting TWAIN File System Information

Remarks

This property is updated with a pointer to an IFileSystem interface that contains information about the TWAIN file system of the selected TWAIN source.

Certain properties of this IFileSystem interface are updated by the QueryFileSystem method.

The properties, accessed through the FileSystemInfo prop, can be set with the appropriate information to allow the QueryFileSystem method to change the TWAIN file system settings. Other properties accessed through this property can be updated with information about the file system. The information that is set or retrieved depends on the value of the FileMsg parameter of the QueryFileSystem method.

The following properties may be used for either changing file system settings, or getting current file system information:

CreateTimeDate property

DeviceGroupMask property

FileSize property

FileType property

FreeMediaSpace property

InputName property

ModifiedTimeDate property

NewImageSize property

NumberOfAudioSnippets property

NumberOfFiles property

OutputName property

Recursive property

See Also

Elements | QueryFileSystem method, CreateTimeDate property, DeviceGroupMask property, FileSize property, FileType property, FreeMediaSpace property, InputName property, ModifiedTimeDate property, NewImageSize property, NumberOfAudioSnippets property, OutputName property, Recursive property
Topics | TWAIN Functionality: Getting or Setting TWAIN File System Information


FileTransferName property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | BSTR FileTransferName
Overview | Refer to How to Acquire from the TWAIN Source.

Remarks

String that contains the name of the file in which to save the images acquired from a TWAIN source, if the transfer mode is File Transfer Mode.

The ScanFileFormat property specifies the file format used when saving image data to the file specified in the FileTransferName property.

To set the transfer mode, call SetCapability method with the appropriate capability constant set in the pCapability parameter.

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, MemBufSize property.
Topics | TWAIN Functionality: Image Functions


ImageBitsPerPixel property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | short ImageBitsPerPixel
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the bits per pixel value used to transfer images from the current TWAIN source.

This property 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).

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


ImageBrightness property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | float ImageBrightness
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the brightness value to use when transferring images from the current TWAIN source.

The brightness values range from –1000 to 1000.

This property internally gets or sets the brightness capability ICAP_BRIGHTNESS. For more information on this capability, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


ImageContrast property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | float ImageContrast
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the contrast value to use when transferring images from the current TWAIN source.

The contrast values range from –1000 to 1000.

This property internally gets or sets the contrast capability ICAP_CONTRAST. For more information on this capability, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


ImageEffects property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILTImageEffects * ImageEffects
Overview | Refer to Getting and Setting Capabilities.

Remarks

(Read Only) Gets the image effects data properties for the current data source.

This ILTImageEffects object contains the following properties:

Brightness property

ColorScheme property

Contrast property

HalfTone property

HighLight property

PixelFlavor property

Shadow property

The above properties are updated by calling the GetProperties method.

The ImageEffects property itself is read only. However, the properties accessed by this property can be set with new image effect values. To set these values to the TWAIN driver, call the SetProperties method.

See Also

Elements | DataTransfer property, ImageResolution property, EnableAutoFeed property, MaxPagesNumber property, DuplexScanning property, GetProperties method, SetProperties method, LeftMargin property, RightMargin property, TopMargin property, BottomMargin property, PixelFlavor property, ColorScheme property, HighLight property, Shadow property, Brightness property, Contrast property, HalfTone property
Topics | TWAIN Functionality: Driver Settings


ImageFrame property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | ItwFrame * ImageFrame
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the image frame used when transferring images from the current TWAIN source.

The image frame specifies the size and location of the image to acquire.

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


ImageHighlight property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | float ImageHighlight
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the highlight value to use when transferring images from the current TWAIN source.

The contrast values range from 0 to 255.

This property internally gets or sets the highlight capability ICAP_HIGHLIGHT. For more information on this capability, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


ImageResolution property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILTImageResolution * ImageResolution
Overview | Refer to Getting and Setting Capabilities.

Remarks

(Read Only) Gets the image resolution properties for the current data source.

This ILTImageResolution object contains the following properties:

BitsPerPixel property

HorizontalResolution property

RotationAngle property

Unit property

VerticalResolution property

XScaling property

YScaling property

The above properties are updated by calling the GetProperties method.

The ImageResolution property itself is read only. However, the properties accessed by this property can be set with new image resolution values. To set these values to the TWAIN driver, call the SetProperties method.

See Also

Elements | ImageEffects property, DataTransfer property, EnableAutoFeed property, MaxPagesNumber property, DuplexScanning property, GetProperties method, SetProperties method, LeftMargin property, RightMargin property, TopMargin property, BottomMargin property, Unit property, BitsPerPixel property, HorizontalResolution property, VerticalResolution property, XScaling property, YScaling property, RotationAngle property
Topics | TWAIN Functionality: Driver Settings


ImageUnit property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | short ImageUnit
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the image unit value used to transfer images from the current TWAIN source.

This property internally gets or 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).

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


IsFileTransferAvailable property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | VARIANT_BOOL IsFileTransferAvailable
Overview | Refer to Getting and Setting Capabilities

Remarks

(Read only) This property is updated with a value that indicates whether the file transfer mode is supported in the current TWAIN source. Possible values are:

Value | Meaning
TRUE | File transfer mode is supported.
FALSE | File transfer mode is not supported.

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


IsMemoryTransferAvailable property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | VARIANT_BOOL IsMemoryTransferAvailable
Overview | Refer to Getting and Setting Capabilities

Remarks

(Read only) This property is updated with a value that indicates whether the memory transfer mode is supported in the current TWAIN source. Possible values are:

Value | Meaning
TRUE | Memory transfer mode is supported.
FALSE | Memory transfer mode is not supported.

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


IsNativeTransferAvailable property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | VARIANT_BOOL IsNativeTransferAvailable
Overview | Refer to Getting and Setting Capabilities

Remarks

(Read only) This property is updated with a value that indicates whether the native transfer mode is supported in the current TWAIN source. Possible values are:

Value | Meaning
TRUE | Native transfer mode is supported.
FALSE | Native transfer mode is not supported.

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


JPEGCompressionData property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | ITwainJpegCompression* JPEGCompressionData
Overview | Refer to Using JPEG Compression for a TWAIN Source.

Remarks

Gets or sets the JPEG compression options used by the current TWAIN session.

This ITwainJpegCompression object contains the following properties:

ColorSpace property

HuffmanAC property

HuffmanDC property

HuffmanMap property

NumComponents property

QuantMap property

QuantTable property

RestartFrequency property

SubSampling property

The above properties are updated by calling the GetJPEGCompression method.

To set the JPEG compression options for the current TWAIN session, set the above properties and call the SetJPEGCompression method.

A TWAIN session is started by calling the InitSession method.

See Also

Elements | GetJPEGCompression method, SetJPEGCompression method
Topics | TWAIN Functionality: JPEG Compression Functions


LeftMargin property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | float LeftMargin
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets or sets the value of the left margin of the scanning area.

The unit of measure for this property is determined by the Unit property.

This property is equivalent to the ICAP_FRAMES capability. There are two ways of determining the possible values for this capability:

call the QueryCapability method with pCapability. Capability set to ICAP_FRAMES.

call the GetCapability method (MFC) or the GetCapability2 method (VB) with pCapability. Capability set to ICAP_FRAMES and the IFlags parameter set to L_LTWAIN_CAPABILITY_GETVALUES.

For more information on specific TWAIN capabilities, refer to the TWAIN 1.9 specification.

This property is updated with the driver’s current value by calling the GetProperties method.

To set a new left margin value to the TWAIN driver, assign a new value to this property and call the SetProperties method.

See Also

Elements | ImageEffects property, DataTransfer property, ImageResolution property, EnableAutoFeed property, MaxPagesNumber property, DuplexScanning property, GetProperties method, SetProperties method, RightMargin property, TopMargin property, BottomMargin property, Unit property, GetCapability method, GetCapability2 method, QueryCapability method
Topics | TWAIN Functionality: Driver Settings


ManName property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | BSTR ManName
Overview | Refer to Initializing a TWAIN Session.

Remarks

(Write only) Application specific string that contains the name of the application's manufacturer. Using this property is optional.

See Also

Elements | ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: Application Functions


ManufacturerName property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | BSTR ManufacturerName(long nIndex)
Overview | Refer to Managing the TWAIN Source.

Remarks

(Read only) Gets a character string that contains the manufacturer's name of the specified TWAIN source. This name is provided by the manufacturer.

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate metho, LoadTemplate method, FileTransferName property, MemBufSize property, FamilyName property, SelectedFamilyName property, SelectedManufacturerName property
Topics | TWAIN Functionality: TWAIN Source Functions.


MaxPagesNumber property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long MaxPagesNumber
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets or sets the maximum number of pages to get from the selected TWAIN source.

If this property is set to –1, the maximum number of pages is considered to be unlimited.

To update this property with the current value, call the GetProperties method.

To set the MaxPagesNumber value to the TWAIN driver, assign a new value to this property and call the SetProperties method.

See Also

Elements | ImageEffects property, DataTransfer property, ImageResolution property, EnableAutoFeed property, DuplexScanning property, GetProperties method, SetProperties method, LeftMargin property, RightMargin property, TopMargin property, BottomMargin property
Topics | TWAIN Functionality: Driver Settings


MaxXferCount property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | short MaxXferCount
Overview | Refer to Getting and Setting Capabilities

Remarks

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

This property internally gets or sets the maximum transfers count capability CAP_XFERCOUNT. For more information on this capability, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


MemBufSize property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long MemBufSize
Overview | Refer to How to Acquire from the TWAIN Source.

Remarks

(Read only) Gets the buffer size to use when retrieving images from the selected TWAIN source.

It is used when the transfer mode is set to be memory buffered.

To set the transfer mode, call SetCapability method with the appropriate capability constant set in the pCapability parameter.

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property.
Topics | TWAIN Functionality: Image Functions


PaperDirection property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | short PaperDirection
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the page orientation to use when transferring data from the current TWAIN source.

This property internally gets or sets the page size capability ICAP_ORIENTATION. For more information on this capability, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


PaperSize property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | short PaperSize
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the page size to use when transferring data from the current TWAIN source.

This property internally gets or sets the page size capability ICAP_SUPPORTEDSIZES. For more information on this capability, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


ProdFamily property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | BSTR ProdFamily
Overview | Refer to Initializing a TWAIN Session.

Remarks

(Write only) Application specific string that contains the product family name. Using this property is optional.

See Also

Elements | ManName property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: Application Functions


RGBElements property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | ITwainRGBElements* RGBElements(short iIndex);
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets a specific RGB element data according to the index passed to this property.

This ITwainRGBElements object contains the following properties:

Index Property

Channel1 Property

Channel2 Property

Channel3 property

The above properties accessed by this property can be set with new RGB element values. To set these values, call the SetRGBResponse method.

See Also

Elements | Index Property, Channel1 Property, Channel2 Property, Channel3 property, TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


RGBElementsCount property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | short RGBElementsCount
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the number of RGB elements in the RGBElements property.

To set the number of RGB elements, assign a new value to this property and call the SetRGBResponse method.

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


RightMargin property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | float RightMargin
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets or sets the value of the right margin of the scanning area.

The unit of measure for this property is determined by the Unit property.

This property is equivalent to the ICAP_FRAMES capability. There are two ways of determining the possible values for this capability:

call the QueryCapability method with pCapability. Capability set to ICAP_FRAMES.

call the GetCapability method (MFC) or the GetCapability2 method (VB) with pCapability. Capability set to ICAP_FRAMES and the IFlags parameter set to L_LTWAIN_CAPABILITY_GETVALUES.

For more information on specific TWAIN capabilities, refer to the TWAIN 1.9 specification.

This property is updated with the driver’s current value by calling the GetProperties method.

To set a new right margin value to the TWAIN driver, assign a new value to this property and call the SetProperties method.

See Also

Elements | ImageEffects property, DataTransfer property, ImageResolution property, EnableAutoFeed property, MaxPagesNumber property, DuplexScanning property, GetProperties method, SetProperties method, LeftMargin property, TopMargin property, BottomMargin property, Unit property, GetCapability method, GetCapability2 method, QueryCapability method
Topics | TWAIN Functionality: Driver Settings


ScanConfig Property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILTFastConfig * ScanConfig(short iIndex)
Overview | Refer to Fast TWAIN (Scan Configurations)

Remarks

(Read Only) Gets a pointer to an array of scan configurations retrieved by the GetScanConfigs method.

The number of scan configurations in this property can be found in the ScanConfigCount property.

See Also

Elements | GetScanConfigs method, ScanConfigCount property
Topics | Twain Functionality: Fast TWAIN (Scan Configurations)


ScanConfigCount Property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short ScanConfigCount
Overview | Refer to Fast TWAIN (Scan Configurations)

Remarks

(Read Only) Gets the number of scan configurations retrieved by the GetScanConfigs method.

The scan configurations retrieved by the GetScanConfigs method can be found in the ScanConfig property.

See Also

Elements | GetScanConfigs method, ScanConfig property
Topics | Twain Functionality: Fast TWAIN (Scan Configurations)


SelectedFamilyName property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | BSTR SelectedFamilyName
Overview | Refer to Managing the TWAIN Source.

Remarks

(Read only) Gets a character string that contains the family name of the selected TWAIN source. This name is provided by the manufacturer.

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property, FamilyName property, ManufacturerName property, SelectedManufacturerName property
Topics | TWAIN Functionality: TWAIN Source Functions.


SelectedManufacturerName property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | BSTR SelectedManufacturerName
Overview | Refer to Managing the TWAIN Source.

Remarks

(Read only) Gets a character string that contains the manufacturer's name of the selected TWAIN source. This name is provided by the manufacturer.

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property, FamilyName property, ManufacturerName property, SelectedFamilyName property
Topics | TWAIN Functionality: TWAIN Source Functions.


SelectedSourceName property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | BSTR SelectedSourceName
Overview | Refer to Managing the TWAIN Source.

Remarks

(Read only) String that contains the name of the selected TWAIN source. This name is provided by the manufacturer.

See Also

Elements | SourceName property, ManName property, ProdFamily property, Version property, AppName property, SourceCount property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: TWAIN Source Functions


SourceCount property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long SourceCount
Overview | Refer to Managing the TWAIN Source.

Remarks

(Read only) Contains the number of available TWAIN sources installed on the system.

This property is updated when the SelectSource method is called.

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: TWAIN Source Functions


SourceName property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | BSTR SourceName (long nIndex)
Overview | Refer to Managing the TWAIN Source.

Remarks

(Read only) String that contains the name of the specified TWAIN source. This name is provided by the manufacturer.

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: TWAIN Source Functions


StopFeedPages Property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | BOOL StopFeedPages
Overview | Refer to How to Acquire from the Twain Source.

Remarks

Gets or sets a value that indicates whether to continue or stop feeding pages while acquiring images from a TWAIN source. Possible values are:

Setting | Description
TRUE | Stop feeding pages during the TWAIN image acquisition process.
FALSE | Continue feeding pages during the TWAIN image acquisition process.

See Also

Elements | Acquire method, AcquirePageEvent event, ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: Image Functions


StopFindFastConfig Property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | VARIANT_BOOL StopFindFastConfig
Overview | Refer to Fast TWAIN (Scan Configurations)

Remarks

Gets or sets a value that indicates whether to continue or stop the scan configuration testing process started by the FindFastConfig method. Possible values are:

Setting | Description
TRUE | Stop the scan configuration testing process.
FALSE | Continue the scan configuration testing process.

See Also

Elements | EnableFastConfigEvent property, UserFastConfigs property, UserFastConfigsCount property, FastConfigsResult property, FastConfigsResultCount property, BestFastConfig property, FindFastConfig method, FastConfigEvent event
Topics | Twain Functionality: Fast TWAIN (Scan Configurations)


TopMargin property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | float TopMargin
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets or sets the value of the top margin of the scanning area.

The unit of measure for this property is determined by the Unit property.

This property is equivalent to the ICAP_FRAMES capability. There are two ways of determining the possible values for this capability:

call the QueryCapability method with pCapability. Capability set to ICAP_FRAMES.

call the GetCapability method (MFC) or the GetCapability2 method (VB) with pCapability. Capability set to ICAP_FRAMES and the IFlags parameter set to L_LTWAIN_CAPABILITY_GETVALUES.

For more information on specific TWAIN capabilities, refer to the TWAIN 1.9 specification.

This property is updated with the driver’s current value by calling the GetProperties method.

To set a new top margin value to the TWAIN driver, assign a new value to this property and call the SetProperties method.

See Also

Elements | ImageEffects property, DataTransfer property, ImageResolution property, EnableAutoFeed property, MaxPagesNumber property, DuplexScanning property, GetProperties method, SetProperties method, LeftMargin property, RightMargin property, BottomMargin property, Unit property, GetCapability method, GetCapability2 method, QueryCapability method
Topics | TWAIN Functionality: Driver Settings


TransferCompressionType property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | long TransferCompressionType
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the compression type to use when transferring data from the current TWAIN source. This property is valid only if the TransferMode property is set to L_TWAIN_TRANSFER_MEMORY.

To update this property with the current value, call the GetTransferOptions method.

To set the compression type, assign a new value to this property and call the SetTransferOptions method.

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


TransferFileFormat property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | long TransferFileFormat
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the transfer file format to use when transferring data from the current TWAIN source. This property is valid only if the TransferMode property is set to L_TWAIN_TRANSFER_FILE. For more information about the supported file formats, refer to the Summary of Supported Image File Formats .

To update this property with the current value, call the GetTransferOptions method.

To set the file format, assign a new value to this property and call the SetTransferOptions method.

See Also

Elements | TransferMode property, TransferFileName property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


TransferFileName property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | BSTR TransferFileName
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the file name to use when transferring data from the current TWAIN source. This property is valid only if the TransferMode property is set to L_TWAIN_TRANSFER_FILE.

To update this property with the current value, call the GetTransferOptions method.

To set the file name, assign a new value to this property and call the SetTransferOptions method.

See Also

Elements | TransferMode property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


TransferMode property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | TWAINTRANSFERMODES TransferMode
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the transfer mode used for transferring data from the current TWAIN source. For possible values, refer to the TWAINTRANSFERMODES enumeration.

To update this property with the current value, call the GetTransferOptions method.

To set the transfer mode, assign a new value to this property and call the SetTransferOptions method.

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


UserFastConfigs Property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILTFastConfig * UserFastConfigs(short iIndex)
Overview | Refer to Fast TWAIN (Scan Configurations)

Remarks

Contains an array of user-defined scan configurations that will be tested by the FindFastConfig method.

To fill this property with user-defined scan configurations, first, set the number of scan configurations in the UserFastConfigsCount property. Then, set the array of scan configurations in this property.

The BestFastConfig object has the properties listed below. For more information on each sub-property, follow the appropriate link.

Property | Type | Description
BitsPerPixel property (ILTFastConfig) | short | Bits per pixel of the scan configuration
BufferSize property (ILTFastConfig) | long | Buffer size of the scan configuration
FileFormat property (ILTFastConfig) | short | File format of the scan configuration
RequiredTime property (ILTFastConfig) | long | Amount of time to scan the test pages for the scan configuration
TransferMode property (ILTFastConfig) | short | Transfer mode of the scan configuration

See Also

Elements | EnableFastConfigEvent Property, UserFastConfigsCount property, FastConfigsResult property, FastConfigsResultCount property, BestFastConfig property, FindFastConfig method, StopFindFastConfig property, FastConfigEvent event
Topics | Twain Functionality: Fast TWAIN (Scan Configurations)


UserFastConfigsCount Property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short UserFastConfigsCount
Overview | Refer to Fast TWAIN (Scan Configurations)

Remarks

Gets or sets the number of scan configurations in the UserFastConfigs property.

This property must be set before setting the scan configurations in the UserFastConfigs property.

See Also

Elements | EnableFastConfigEvent property, UserFastConfigs property, FastConfigsResult property, FastConfigsResultCount property, BestFastConfig property, FindFastConfig method, StopFindFastConfig property, FastConfigEvent event
Topics | Twain Functionality: Fast TWAIN (Scan Configurations)


Version property (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | BSTR Version
Overview | Refer to Initializing a TWAIN Session.

Remarks

(Write only) Application specific string that contains the version information.

See Also

Elements | ManName property, ProdFamily property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: Application Functions


XResolution property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | float XResolution
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the horizontal resolution used to transfer images from the current TWAIN source.

This property internally gets or sets the horizontal resolution capability ICAP_XRESOLUTION. For more information on this capability, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

To get or set the vertical resolution, use the YResolution property.

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


YResolution property (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | float YResolution
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the vertical resolution used to transfer images from the current TWAIN source.

This property internally gets or sets the vertical resolution capability ICAP_YRESOLUTION. For more information on this capability, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

To get or set the horizontal resolution, use the XResolution Property.

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


Acquire method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short Acquire (long lFlags)
Overview | Refer to How to Acquire from the TWAIN Source.

Remarks

Acquires one or more images from a TWAIN source.

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.

This method gets images from the selected TWAIN source. For each image acquired from the TWAIN source, an AcquirePageEvent event is generated, and the image is passed to the event.

The Acquire method acquires pages 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.

To set the transfer mode, call SetCapability method with the appropriate capability constant set in the pCapability parameter.

See Also

Elements | AcquirePageEvent event, ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: Image Functions


AcquireMulti method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short AcquireMulti(BSTR bstrBaseFileName, long lFlags, VARIANT_BOOL bMulti)
Overview | Refer to How to Acquire from the TWAIN Source.

Remarks

(Document/Medical) Acquires one or more images from a TWAIN source and stores the images in the specified file.

Based on the scanner type, this method will determine the best/fastest scanning method to use. This scanning method will be used when actually scanning the images.

Before calling this method:

1. | You can call the FindFastConfig method to determine the best scan configuration.
2. | Then set the scan configuration information in the FastTransferMode property, FastFormat property, FastBitsPerPixel property, FastBufferSize property and FastUsePreferredBufferSize property.

Note:

If you do not call FindFastConfigs before calling AcquireMulti, then the AcquireMulti method will determine the best scanning method.

If the file format set in the FastFormat property does not support multi-page files, this method will ignore the bMulti 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 bstrBaseFileName 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 the FastFormat property supports multi-page files, this method will use the bMulti parameter to determine how to save multiple images. If bMulti is FALSE, each scanned page will be saved to a separate file, named in the same manner described in the paragraph above. If bMulti is TRUE, the name of the output file will be exactly the string in bstrBaseFileName (Temp.jpg) and it will be saved as a multi-page file.

If the FastTransferMode property is set to LTWAIN_BUFFER_MODE, and the FastUsePreferredBufferSize property is set to FALSE, then the method will use the user-defined buffer size in the FastBufferSize property. If however, the FastUsePreferredBufferSize property is set to TRUE, then the method will use the Twain driver preferred buffer size and will ignore the value of FastBufferSize property.

To use the AcquireMultiEvent event, you should set the EnableAcquireMultiEvent property value to TRUE before calling the AcquireMulti method.

The AcquireMultiEvent event will be fired twice for each scanned page. The event is fired the first time when the Twain source begins scanning the page. The event is fired the second time when the Twain source has finished scanning the page..

See Also

Elements | FastTransferMode property, FastFormat property, FastBitsPerPixel property, FastBufferSize property, FastUsePreferredBufferSize property, FindFastConfig method
Topics | TWAIN Functionality: Image Functions


EndSession method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short EndSession ()
Overview | Refer to Freeing the TWAIN Session.

Remarks

Ends a TWAIN session.

A TWAIN session is started by calling the InitSession method.

For each call to the InitSession method there must be a call to the EndSession method.

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: Session Functions


FindFastConfig method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short FindFastConfig(BSTR bstrWorkingFolder, long lFlags, short iBitsPerPixel, short iBufferIteration)
Overview | Refer to Fast TWAIN (Scan Configurations)

Remarks

(Document/Medical only) Determines the best scanner configuration.

This method will test scan configurations for the scanner selected using the SelectSource method. It will update the BestFastConfig property with the best/fastest scan configuration tested. Using the fastest scan configuration lets you scan images in as fast as possible. 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 set by setting the FastTransferMode property, FastFormat property, FastBitsPerPixel property, FastBufferSize property and FastUsePreferredBufferSize property before calling the AcquireMulti method, so the images can be scanned as fast as possible.

To test user-defined/custom configurations, set the number of user-defined scan configurations in the UserFastConfigsCount property, then assign the scan configurations to the UserFastConfigs property.

To test the default configurations available for the Twain driver, set the UserFastConfigsCount property to 0.

The list of default scan configurations to test can be shortened by using the GetScanConfigs method to get a list of default scan configurations based on transfer mode, bits per pixel and number of buffers. The ScanConfig property is updated with the retrieved list of scan configurations. Next, assign the value of the ScanConfigCount property to the UserFastConfigsCount property. Then, assign the array of scan configurations in the ScanConfig property to the UserFastConfigs property. Call the FindFastConfigs method to determine the best and fastest scan configuration.

If L_LTWAIN_CHECK_ALL_DEFAULT_BPP is set in lFlags then the method will test all supported bits per pixel for the selected scanner. If this flag is not set in lFlags, then the method will test the bits per pixel specified in the iBitsPerPixel parameter.

If L_LTWAIN_USE_THREAD_MODE is set in lFlags, 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 iBitsPerPixel parameter and the L_LTWAIN_CHECK_ALL_DEFAULT_BPP flag will be used only if the transfer mode for the scan configuration being tested is L_LTWAIN_BUFFER_MODE or L_LTWAIN_NATIVE_MODE.

The iBufferIteration parameter will be used only if the FastTransferMode property for the scan configuration being tested is L_LTWAIN_BUFFER_MODE. The buffer iteration value determines the buffer sizes to be tested. The purpose for testing the memory transfer mode with different buffer sizes is to determine the buffer size that will provide the fastest scan configuration. The buffer iteration specifies the number of buffer sizes that will be tested. The buffer size is the size of the transferred data from the Twain source.

To stop the scan configuration testing process, set the StopFindFastConfig property to TRUE within the FastConfigEvent event. The StopFindFastConfig property must be set to FALSE to continue the scan configuration process.

See Also

Elements | EnableFastConfigEvent property, UserFastConfigs property, UserFastConfigsCount property, FastConfigsResult property, FastConfigsResultCount property, BestFastConfig property, StopFindFastConfig property, FastConfigEvent event
Topics | Twain Functionality: Fast TWAIN (Scan Configurations)


GetCapability method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short GetCapability (IUnknown * pCapability, long lFlags)
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets the specified capability value(s).

The pCapability parameter must contain data corresponding to the capability to get. It will be updated with the specified values of that capability.

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property, GetProperties method, SetProperties method, LeftMargin property, RightMargin property, TopMargin property, BottomMargin property, Unit property, BitsPerPixel property, HorizontalResolution property, VerticalResolution property, XScaling property, YScaling property, RotationAngle property, MemoryBufferSize property, HighLight property, Shadow property, Brightness property, Contrast property, HalfTone property.
Topics | TWAIN Functionality: Capability Functions


GetCapability2 method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short GetCapability (ILEADTwainCapability * pltTwCap, long lFlags)
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets the specified capability value(s).

The pltTwCap parameter must contain data corresponding to the capability to get. It will be updated with the specified values of that capability.

See Also

Elements | CapInfo property, CapArray property, CapEnum property, CapOneValue property, CapRange property, EnableMethodErrors property, ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability2 method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property, GetProperties method, SetProperties method, LeftMargin property, RightMargin property, TopMargin property, BottomMargin property, Unit property, BitsPerPixel property, HorizontalResolution property, VerticalResolution property, XScaling property, YScaling property, RotationAngle property, MemoryBufferSize property, HighLight property, Shadow property, Brightness property, Contrast property, HalfTone property.
Topics | TWAIN Functionality: Capability Functions


GetExtImageInfo method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short GetExtImageInfo(IDispatch * pExtImageInfo);
Overview | Refer to How to Acquire from the TWAIN Source.

Remarks

Gets the extended image information related to the image acquired by the Acquire method.

This method can only be called during the AcquirePageEvent event, which occurs for each page acquired by the Acquire method.

Extended image information can be Barcode texts, Barcode data, etc. For more information on extended image information, refer to the LEADTOOLS TWAIN Defines.

Calling this method updates the following properties:

NumOfInfos property

PtwInfo property

See Also

Topics

TWAIN Functionality: Image Functions


GetJPEGCompression method (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | short GetJPEGCompression(short iFlags)
Overview | Refer to Using JPEG Compression for a TWAIN Source.

Remarks

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

This method updates the JPEGCompressionData property with the either the current or default JPEG compression settings, depending on the flag passed to the iFlags parameter.

To set the JPEG compression options for the current TWAIN session, set the ITwainJpegCompression properties referenced by the JPEGCompressionData property and call the SetJPEGCompression method.

A TWAIN session is started by calling the InitSession method.

See Also

Elements | SetJPEGCompression method, JPEGCompressionData property
Topics | TWAIN Functionality: JPEG Compression Functions


GetTransferOptions method (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | short GetTransferOptions()
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets the current transfer options for the current Twain source.

This method updates the following properties:

TransferMode property

TransferFileName property

TransferFileFormat property

TransferCompressionType property

To set the transfer options, update all of the properties referenced above and call the SetTransferOptions method.

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


GetProperties method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short GetProperties();
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets the current TWAIN source properties from the TWAIN driver.

This method lets the user get information on the properties currently set for the TWAIN driver. It is a high-level alternative to getting individual capabilities using the GetCapability method (MFC) or the GetCapability2 method (VB). For more information on getting and setting TWAIN capabilities, refer to Getting and Setting Capabilities.

Calling this method will update the following properties:

ImageEffects property

DataTransfer property

ImageResolution property

EnableAutoFeed property

MaxPagesNumber property

DuplexScanning property

LeftMargin property

RightMargin property

TopMargin property

BottomMargin property

Note that the ImageEffects, DataTransfer, and ImageResolution properties are read-only interface properties that contain multiple sub-properties. Calling the GetProperties method updates each individual sub-property associated with the three interface properties.

For more information on the available sub-properties, refer to the ImageEffects property, DataTransfer property, and the ImageResolution property.

Not all TWAIN capabilities can be retrieved using the GetProperties method. Depending on the TWAIN source, some capabilities can only be retrieved using the GetCapability method (MFC) or the GetCapability2 method (VB).

For a listing of available capabilities, refer to LEADTOOLS TWAIN Defines.

For more information on specific TWAIN capabilities, refer to the TWAIN 1.9 specification.

To set the document source properties, update all of the properties referenced above and call the SetProperties method, which sets the updated properties to the TWAIN driver.

See Also

Elements | ImageEffects property, DataTransfer property, ImageResolution property, EnableAutoFeed property, MaxPagesNumber property, DuplexScanning property, SetProperties method, LeftMargin property, RightMargin property, TopMargin property, BottomMargin property, Unit property, BitsPerPixel property, HorizontalResolution property, VerticalResolution property, XScaling property, YScaling property, RotationAngle property, FillOrder property, BufferMemoryCompression property, TransferMode property, ScanFileFormat property, MemoryBufferSize property, EnableSaveMultipageFile property, EnableAppendToFile property, EnableDumpMemoryBuffersToFile property, PixelFlavor property, ColorScheme property, HighLight property, Shadow property, Brightness property, Contrast property, HalfTone property, GetCapability method, GetCapability2 method
Topics | TWAIN Functionality: Driver Settings


GetScanConfigs method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short GetScanConfigs(short iBitsPerPixel, short iTransferMode, short iBufferIteration)
Overview | Refer to Fast TWAIN (Scan Configurations)

Remarks

This method will get the default scan configurations based on the values of iTransferMode, iBitsPerPixel and iBufferIteration.

If iTransferMode is L_LTWAIN_NATIVE_MODE, this method will use the value of iBitsPerPixel to determine which default scan configurations to get.

If iTransferMode is L_LTWAIN_BUFFER_MODE, this method will use both iBitsPerPixel and iBufferIteration to determine which default scan configurations to get.

If iTransferMode is L_LTWAIN_FILE_MODE, this method will use the value of iBitsPerPixel to determine which scan configurations to get.

See Also

Elements | ScanConfig property, ScanConfigCount property
Topics | Twain Functionality: Fast TWAIN (Scan Configurations)


InitSession method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short InitSession (long hWnd)
Overview | Refer to Initializing a TWAIN Session.

Remarks

Initializes the TWAIN session.

Please note that a TWAIN session is a communication session between LEADTOOLS TWAIN and your TWAIN sources. The internal TWAIN session handle that is created provides the user access to this TWAIN session. This method must be called before calling any other methods that require a TWAIN session.

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

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: Session Functions


IsAvailable method (ILEADRasterTwain)

Visual Basic example

Visual C++ 5.0 example

Syntax | BOOL IsAvailable (long hWnd);
Overview | Managing the TWAIN Source

Remarks

Determines whether a TWAIN source is installed.

See Also

Elements | Acquire method, AcquirePageEvent event, ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: Image Functions


IsSupportLocked method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | BOOL IsSupportLocked(short iType)
Overview | Refer to Unlocking Special LEAD Features.

Remarks

Indicates whether support is locked for an optional feature, such as LEADTOOLS Document/Medical capabilities.

For information about LEADTOOLS Document/Medical capabilities, contact LEAD.

To unlock a feature, use the UnlockSupport method.

See Also

Elements

InitSession method, EndSession method, UnlockSupport method


QueryCapability method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short QueryCapability (IUnknown * pCapability)
Overview | Refer to Getting and Setting Capabilities.

Remarks

(Read only) Gets the available capability values for the specified capability.

The pCapability parameter passed to this method should contain information indicating the capability for which to get the available values. This parameter will be updated with the available values for the specified capability.

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property, GetProperties method, SetProperties method, LeftMargin property, RightMargin property, TopMargin property, BottomMargin property, Unit property, BitsPerPixel property, HorizontalResolution property, VerticalResolution property, XScaling property, YScaling property, RotationAngle property, MemoryBufferSize property, HighLight property, Shadow property, Brightness property, Contrast property, HalfTone property.
Topics | TWAIN Functionality: Capability Functions


QueryFileSystem method (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | short QueryFileSystem(FILESYSTEM_MSG FileMsg)
Overview | Refer to Getting or Setting TWAIN File System Information

Remarks

Performs certain tasks, or retrieves certain information, depending on the value of the FileMsg parameter.

This method is only valid for TWAIN file systems for digital cameras.

If the FileMsg parameter contains one of the following flags:

FILESYSTEM_MSG_CHANGEDIRECTORY

FILESYSTEM_MSG_CREATEDIRECTORY

FILESYSTEM_MSG_DELETE

FILESYSTEM_MSG_FORMATMEDIA

FILESYSTEM_MSG_RENAME

FILESYSTEM_MSG_COPY

the sub-properties of the FileSystemInfo property must contain the proper information before calling this method. This method will use the provided information to change settings within the TWAIN files system.

If the FileMsg parameter contains one of the following flags:

FILESYSTEM_MSG_GETCLOSE

FILESYSTEM_MSG_GETFIRSTFILE

FILESYSTEM_MSG_GETINFO

FILESYSTEM_MSG_GETNEXTFILE

This method, will update the appropriate sub-properties of the FileSystemInfo property with the corresponding information.

If the FileMsg parameter contains the following flag:

FILESYSTEM_MSG_AUTOMATICCAPTUREDIRECTORY

This method will use the information stored within the appropriate sub-properties of the FileSystemInfo property and will update the appropriate sub-properties of the FileSystemInfo property with any appropriate information.

For more information on the available TWAIN file system information, refer to the TW_FILESYSTEM structure, in the TWAIN 1.9 Specification, available at www.twain.org.

See Also

Elements | FileSystemInfo property
Topics | TWAIN Functionality: Getting or Setting TWAIN File System Information


SaveTemplate method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short SaveTemplate (BSTR strTemplateFile)
Overview | Refer to Handling Template Files.

Remarks

Enumerates all supported capabilities, and the current values, for the currently selected TWAIN source and saves them to the specified template file.

For each capability enumerated by this method, a SaveTemplateEvent event occurs.

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

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, LoadTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: Template Functions


SelectSource method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short SelectSource ()
Overview | Refer to Managing the TWAIN Source.

Remarks

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

This method updates the following properties:

Capability property

CapsCount property

SourceCount property

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: TWAIN Source Functions


SetCapability method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short SetCapability (IUnknown * pCapability, long lFlags)
Overview | Refer to Getting and Setting Capabilities.

Remarks

Sets the value of the specified capability.

To set the transfer mode, call the SetCapability method with the appropriate capability constant set in the pCapability parameter.

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property, SetProperties method
Topics | TWAIN Functionality: Capability Functions


SetCapability2 method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short SetCapability2 (ILEADTwainCapability * pltTwCap, long lFlags)
Overview | Refer to Getting and Setting Capabilities.

Remarks

Sets the value of the specified capability.

To set the transfer mode, call the SetCapability2 method with the appropriate capability constant set in the pltTwCap parameter.

See Also

Elements | CapInfo property, CapArray property, CapEnum property, CapOneValue property, CapRange property, EnableMethodErrors property, ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, GetCapability2 method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property, SetProperties method
Topics | TWAIN Functionality: Capability Functions


SetJPEGCompression method (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | short SetJPEGCompression (short iFlags)
Overview | Refer to Using JPEG Compression for a TWAIN Source.

Remarks

Sets the JPEG compression options for the current TWAIN session.

This method lets the user set JPEG compression options for the current TWAIN session, or reset the default JPEG compression options for the current TWAIN session, depending on the flag passed to the iFlags parameter.

To get the JPEG compression options for the current TWAIN session, call the GetJPEGCompression method.

To set new JPEG compression options, get the current options by calling the GetJPEGCompression method. This will update the JPEGCompressionData property. This property provides access to the ITwainJpegCompression properties. Set these ITwainJpegCompression properties to the new values and then call the SetJPEGCompression method.

A TWAIN session is started by calling the InitSession method.

See Also

Elements | GetJPEGCompression method, JPEGCompressionData property
Topics | TWAIN Functionality: JPEG Compression Functions


SetProperties method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short SetProperties()
Overview | Refer to Getting and Setting Capabilities.

Remarks

Sets the current TWAIN source properties to the TWAIN driver.

This method lets the user set specific TWAIN driver settings. It is a high-level alternative to setting individual capabilities using the SetCapability method (MFC) or the SetCapability2 method (VB). For more information on getting and setting TWAIN capabilities, refer to Getting and Setting Capabilities.

Calling this method sets the following properties:

ImageEffects property

DataTransfer property

ImageResolution property

EnableAutoFeed property

MaxPagesNumber property

DuplexScanning property

LeftMargin property

RightMargin property

TopMargin property

BottomMargin property

Note that the ImageEffects, DataTransfer, and ImageResolution properties are read-only interface properties that contain multiple sub-properties. Calling the SetProperties method sets each individual sub-property associated with the three interface properties to the TWAIN driver.

For more information on the sub-properties, refer to the ImageEffects property, DataTransfer property, and the ImageResolution property.

Note that not all TWAIN capabilities can be set using the SetProperties method. Depending on the TWAIN source, some capabilities can only be set using the SetCapability method (MFC) or the SetCapability2 method (VB).

For a listing of available capabilities, refer to LEADTOOLS TWAIN Defines.

For more information on specific TWAIN capabilities, refer to the TWAIN 1.9 specification.

To get the current values for the above properties, call the GetProperties method.

See Also

Elements | ImageEffects property, DataTransfer property, ImageResolution property, EnableAutoFeed property, MaxPagesNumber property, DuplexScanning property, GetProperties method, LeftMargin property, RightMargin property, TopMargin property, BottomMargin property, Unit property, BitsPerPixel property, HorizontalResolution property, VerticalResolution property, XScaling property, YScaling property, RotationAngle property, FillOrder property, BufferMemoryCompression property, TransferMode property, ScanFileFormat property, MemoryBufferSize property, EnableSaveMultipageFile property, EnableAppendToFile property, EnableDumpMemoryBuffersToFile property, PixelFlavor property, ColorScheme property, HighLight property, Shadow property, Brightness property, Contrast property, HalfTone property, SetCapability method, SetCapability2 method
Topics | TWAIN Functionality: Driver Settings


SetRGBResponse method (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | short SetRGBResponse(short iFlag, short nBitsPerPixel);
Overview | Refer to Getting and Setting Capabilities

Remarks

Sets the RGB elements used when transferring data from the current TWAIN source.

Set the following properties before calling the SetRGBResponse method:

RGBElements property

RGBElementsCount Property

The SetRGBResponse method will use the values in these properties to set the RGB elements for the current TWAIN source.

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property
Topics | TWAIN Functionality: Capability Functions


SetTransferOptions method (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | short SetTransferOptions()
Overview | Refer to Getting and Setting Capabilities

Remarks

Sets the options used for transferring data from the current Twain source.

Set the following properties before calling the SetTransferOptions method:

TransferMode property

TransferFileName property

TransferFileFormat property

TransferCompressionType Property

The SetTransferOptions method will use the values in these properties to set the transfer options for the current TWAIN source.

To get the current values for the above properties, call the GetTransferOptions method.

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, ShowProgress method, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


ShowProgress method (ILEADRasterTwain)

Visual Basic example

Visual C++ example

Syntax | short ShowProgress(VARIANT_BOOL bShow);
Overview | Refer to Getting and Setting Capabilities

Remarks

Enables or disables the display of a progress indicator during the acquisition of images from the current TWAIN source.

See Also

Elements | TransferMode property, TransferFileName property, TransferFileFormat property, TransferCompressionType Property, SetTransferOptions method, GetTransferOptions method, IsFileTransferAvailable property, IsMemoryTransferAvailable property, IsNativeTransferAvailable property, XResolution Property, YResolution property, ImageFrame property, ImageUnit property, ImageBitsPerPixel property, ImageBrightness property, ImageContrast property, ImageHighlight property, PaperSize property, PaperDirection property, EnableDuplex property, DuplexMode property, MaxXferCount Property, RGBElements property, RGBElementsCount Property, SetRGBResponse method
Topics | TWAIN Functionality: Capability Functions


ShowTemplateDlg method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short ShowTemplateDlg (BSTR strTemplateFile)
Overview | Refer to Handling Template Files.

Remarks

Displays the TWAIN source manufacturer's template dialog, without actually acquiring an image.

Pressing the OK button on the dialog will enumerate all supported TWAIN capability values and save them to the specified file.

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: Template Functions


UnlockSupport method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | UnlockSupport(short iType, BSTR pszKey)
Overview | Refer to Unlocking Special LEAD Features.

Remarks

Unlocks support for an optional feature, such as or LEADTOOLS Document/Medical capabilities.

For information about LEADTOOLS Document/Medical capabilities, contact LEAD.

Note:

UnlockSupport can be replaced by entering the appropriate keys in LTOCX14.LIC. Edit the LTOCX14.LIC file and append at the end of a line, and on the same line, one or more pairs in the form |L_SUPPORT_xxx=key. The keys that can be specified are:

L_SUPPORT_BARCODES_1D
L_SUPPORT_BARCODES_1D_SILVER
L_SUPPORT_BARCODES_PDF_READ
L_SUPPORT_BARCODES_PDF_WRITE
L_SUPPORT_BARCODES_DATAMATRIX_READ
L_SUPPORT_BARCODES_DATAMATRIX_WRITE
L_SUPPORT_BARCODES_QR_READ
L_SUPPORT_BARCODES_QR_WRITE
L_SUPPORT_BITONAL
L_SUPPORT_CMW
L_SUPPORT_DICOM
L_SUPPORT_DOCUMENT
L_SUPPORT_EXTGRAY
L_SUPPORT_J2K
L_SUPPORT_MEDICAL
L_SUPPORT_MEDICAL_NET
L_SUPPORT_OCR
L_SUPPORT_VECTOR
L_SUPPORT_LTPRO

For example, if you wanted to unlock DOCUMENT and VECTOR support, you would include the following at the end of the first line:

|L_SUPPORT_DOCUMENT=dockey|L_SUPPORT_VECTOR=veckey

See Also

Elements

InitSession method, EndSession method, IsSupportLocked method


AcquireMultiEvent event (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | void AcquireMultiEvent(nPage, bstrFileName, bFinishScan)
Overview | Refer to How to Acquire from the Twain Source.

Remarks

(Document/Medical only) This event is fired twice for each scanned page, if the EnableAcquireMultiEvent property is set to TRUE.

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

See Also

Elements | AcquireMulti method, EnableAcquireMultiEvent Property, FastTransferMode property, FastFormat property, FastBitsPerPixel property, FastBufferSize property, FastUsePreferredBufferSize property
Topics | Fast TWAIN (Scan Configurations)


AcquirePageEvent event (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | void AcquirePageEvent (long pBitmap)
Overview | Refer to How to Acquire from the TWAIN Source.

Remarks

Occurs for each page acquired from the currently selected TWAIN source using the Acquire method.

If the user acquired several pages at the same time, a separate event occurs for each page.

The GetExtImageInfo method can only be called within this event.

See Also

Elements | Acquire method, ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: Image Functions


FastConfigEvent event (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | void FastConfigEvent(ILTFastConfig * pltResConfig)
Overview | Refer to Fast TWAIN (Scan Configurations)

Remarks

(Document/Medical only) This event is fired for each scan configuration tested, if the value of the EnableFastConfigEvent property is TRUE.

To stop the scan configuration testing process, set the StopFindFastConfig property to TRUE within the FastConfigEvent event. The StopFindFastConfig property must be set to FALSE to continue the scan configuration process.

See Also

Elements | EnableFastConfigEvent property, UserFastConfigs property, UserFastConfigsCount property, FastConfigsResult property, FastConfigsResultCount property, BestFastConfig property, FindFastConfig method, StopFindFastConfig property
Topics | Twain Functionality: Fast TWAIN (Scan Configurations)


LoadTemplate method (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short LoadTemplate (BSTR strTemplateFile)
Overview | Refer to Handling Template Files.

Remarks

Loads the TWAIN capability values stored in the specified template file and sets the selected TWAIN source using these values.

For each capability loaded by this method, a LoadTemplateEvent event occurs.

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

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: Template Functions


LoadTemplateEvent event (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | void LoadTemplateEvent (IUnknown * pCapability)
Overview | Refer to Handling Template Files.

Remarks

Occurs when loading TWAIN capabilities stored in a template file by calling the LoadTemplate method. It is called after loading the capability from the file, but before the capability value has been set for the currently selected TWAIN source.

It is called for each capability loaded from the file.

The user can change the value of the capability loaded before it is set in the currently selected TWAIN source.

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: Template Functions


LoadTemplateEvent2 event (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | void LoadTemplateEvent2 (ILEADTwainCapability * pCapability)
Overview | Refer to Handling Template Files.

Remarks

Occurs when loading TWAIN capabilities stored in a template file by calling the LoadTemplate method. It is called after loading the capability from the file, but before the capability value has been set for the currently selected TWAIN source.

This event will be fired only if the value of the EnableLoadTemplateEvent property is set to TRUE.

It is called for each capability loaded from the file.

The user can change the value of the capability loaded before it is set in the currently selected TWAIN source.

See Also

Elements | EnableLoadTemplateEvent property, ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property
Topics | TWAIN Functionality: Template Functions


SaveTemplateEvent event (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | void SaveTemplateEvent (IUnknown * pCapability)
Overview | Refer to Handling Template Files.

Remarks

Occurs when saving TWAIN capabilities from the currently selected TWAIN source to a template file by calling the SaveTemplate method. It is called after enumerating the capability from the TWAIN source, but before the capability value has been saved to the template file.

It is called for each capability enumerated on the TWAIN source.

The user can change the value of the capability enumerated, before it is saved.

See Also

Elements | ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property.
Topics | TWAIN Functionality: Template Functions


SaveTemplateEvent2 event (ILEADRasterTwain)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | void SaveTemplateEvent2 (ILEADTwainCapability * pCapability)
Overview | Refer to Handling Template Files.

Remarks

Occurs when saving TWAIN capabilities from the currently selected TWAIN source to a template file by calling the SaveTemplate method. It is called after enumerating the capability from the TWAIN source, but before the capability value has been saved to the template file.

This event will be fired only if the value of the EnableSaveTemplateEvent property is set to TRUE.

It is called for each capability enumerated on the TWAIN source.

The user can change the value of the capability enumerated, before it is saved.

See Also

Elements | EnableSaveTemplateEvent property, ManName property, ProdFamily property, Version property, AppName property, SourceCount property, SourceName property, CapsCount property, Capability property, InitSession method, EndSession method, SelectSource method, SetCapability method, GetCapability method, QueryCapability method, Acquire method, ShowTemplateDlg method, SaveTemplate method, LoadTemplate method, FileTransferName property, MemBufSize property
Topics | TWAIN Functionality: Template Functions


CreateTimeDate property (IFileSystem)

Visual Basic example

Visual C++ example

Syntax | BSTR CreateTimeDate
Overview | Refer to Getting or Setting TWAIN File System Information

Remarks

Gets or sets the creation time and date of a file.

This property may be updated with the current settings, or used to change the current settings for the TWAIN file system, based on the value of the FileMsg parameter of the QueryFileSystem method.

See Also

Elements | QueryFileSystem method, FileSystemInfo property, InputName property, OutputName property, Recursive property, FileType property, FileSize property, ModifiedTimeDate property, FreeMediaSpace property, NewImageSize property, NumberOfFiles property, NumberOfAudioSnippets property, DeviceGroupMask property
Topics | TWAIN Functionality: Getting or Setting TWAIN File System Information


DeviceGroupMask property (IFileSystem)

Visual Basic example

Visual C++ example

Syntax | long DeviceGroupMask
Overview | Refer to Getting or Setting TWAIN File System Information

Remarks

Gets or sets a value that represents a set of bits, in which each bit uniquely identifies a device type. For more information on this, please refer to File Systems in Appendix A of the TWAIN 1.9 Specification, available at www.twain.org.

See Also

Elements | QueryFileSystem method, FileSystemInfo property, InputName property, OutputName property, Recursive property, FileType property, FileSize property, CreateTimeDate property, ModifiedTimeDate property, FreeMediaSpace property, NewImageSize property, NumberOfFiles property, NumberOfAudioSnippets property
Topics | TWAIN Functionality: Getting or Setting TWAIN File System Information


FileSize property (IFileSystem)

Visual Basic example

Visual C++ example

Syntax | long FileSize
Overview | Refer to Getting or Setting TWAIN File System Information

Remarks

Gets or sets the file size in bytes.

This property may be updated with the current settings, or used to change the current settings for the TWAIN file system, based on the value of the FileMsg parameter of the QueryFileSystem method.

See Also

Elements | QueryFileSystem method, FileSystemInfo property, InputName property, OutputName property, Recursive property, FileType property, CreateTimeDate property, ModifiedTimeDate property, FreeMediaSpace property, NewImageSize property, NumberOfFiles property, NumberOfAudioSnippets property, DeviceGroupMask property
Topics | TWAIN Functionality: Getting or Setting TWAIN File System Information


FileType property (IFileSystem)

Visual Basic example

Visual C++ example

Syntax | long FileType
Overview | Refer to Getting or Setting TWAIN File System Information

Remarks

Gets or sets the file type. Possible values are:

Value | Meaning
L_TWFS_FILESYSTEM | [0] Query the file system for information.
L_TWFS_RECURSIVEDELETE | [1] Recursively delete files.

See Also

Elements | QueryFileSystem method, FileSystemInfo property, InputName property, OutputName property, Recursive property, FileSize property, CreateTimeDate property, ModifiedTimeDate property, FreeMediaSpace property, NewImageSize property, NumberOfFiles property, NumberOfAudioSnippets property, DeviceGroupMask property
Topics | TWAIN Functionality: Getting or Setting TWAIN File System Information


FreeMediaSpace property (IFileSystem)

Visual Basic example

Visual C++ example

Syntax | long FreeMediaSpace
Overview | Refer to Getting or Setting TWAIN File System Information

Remarks

(Read only) This property is updated with the bytes of free space left on the current device.

This property may be updated with the current settings, or used to change the current settings for the TWAIN file system, based on the value of the FileMsg parameter of the QueryFileSystem method.

See Also

Elements | QueryFileSystem method, FileSystemInfo property, InputName property, OutputName property, Recursive property, FileType property, FileSize property, CreateTimeDate property, ModifiedTimeDate property, NewImageSize property, NumberOfFiles property, NumberOfAudioSnippets property, DeviceGroupMask property
Topics | TWAIN Functionality: Getting or Setting TWAIN File System Information


InputName property (IFileSystem)

Visual Basic example

Visual C++ example

Syntax | BSTR InputName
Overview | Refer to Getting or Setting TWAIN File System Information

Remarks

Gets or sets the name of the input or source file.

This property may be updated with the current settings, or used to change the current settings for the TWAIN file system, based on the value of the FileMsg parameter of the QueryFileSystem method.

See Also

Elements | QueryFileSystem method, FileSystemInfo property, OutputName property, Recursive property, FileType property, FileSize property, CreateTimeDate property, ModifiedTimeDate property, FreeMediaSpace property, NewImageSize property, NumberOfFiles property, NumberOfAudioSnippets property, DeviceGroupMask property
Topics | TWAIN Functionality: Getting or Setting TWAIN File System Information


ModifiedTimeDate property (IFileSystem)

Visual Basic example

Visual C++ example

Syntax | BSTR ModifiedTimeDate
Overview | Refer to Getting or Setting TWAIN File System Information

Remarks

Gets or sets the date the file was modified.

This property may be updated with the current settings, or used to change the current settings for the TWAIN file system, based on the value of the FileMsg parameter of the QueryFileSystem method.

See Also

Elements | QueryFileSystem method, FileSystemInfo property, InputName property, OutputName property, Recursive property, FileType property, FileSize property, CreateTimeDate property, FreeMediaSpace property, NewImageSize property, NumberOfFiles property, NumberOfAudioSnippets property, DeviceGroupMask property
Topics | TWAIN Functionality: Getting or Setting TWAIN File System Information


NumberOfAudioSnippets property (IFileSystem)

Visual Basic example

Visual C++ example

Syntax | long NumberOfAudioSnippets
Overview | Refer to Getting or Setting TWAIN File System Information

Remarks

Specifies the number of audio snippets.

See Also

Elements | QueryFileSystem method, FileSystemInfo property, InputName property, OutputName property, Recursive property, FileType property, FileSize property, CreateTimeDate property, ModifiedTimeDate property, FreeMediaSpace property, NewImageSize property, NumberOfFiles property, DeviceGroupMask property
Topics | TWAIN Functionality: Getting or Setting TWAIN File System Information


NumberOfFiles property (IFileSystem)

Visual Basic example

Visual C++ example

Syntax | long NumberOfFiles
Overview | Refer to Getting or Setting TWAIN File System Information

Remarks

Specifies the number of files in the media.

See Also

Elements | QueryFileSystem method, FileSystemInfo property, InputName property, OutputName property, Recursive property, FileType property, FileSize property, CreateTimeDate property, ModifiedTimeDate property, FreeMediaSpace property, NewImageSize property, NumberOfAudioSnippets property, DeviceGroupMask property
Topics | TWAIN Functionality: Getting or Setting TWAIN File System Information


NewImageSize property (IFileSystem)

Visual Basic example

Visual C++ example

Syntax | long NewImageSize
Overview | Refer to Getting or Setting TWAIN File System Information

Remarks

Gets or set an estimate of the amount of space required by a new image, based on image layout, resolution and compression of the TWAIN source.

This property may be updated with the current settings, or used to change the current settings for the TWAIN file system, based on the value of the FileMsg parameter of the QueryFileSystem method.

See Also

Elements | QueryFileSystem method, FileSystemInfo property, InputName property, OutputName property, Recursive property, FileType property, FileSize property, CreateTimeDate property, ModifiedTimeDate property, FreeMediaSpace property, NumberOfFiles property, NumberOfAudioSnippets property, DeviceGroupMask property
Topics | TWAIN Functionality: Getting or Setting TWAIN File System Information


OutputName property (IFileSystem)

Visual Basic example

Visual C++ example

Syntax | BSTR OutputName
Overview | Refer to Getting or Setting TWAIN File System Information

Remarks

Gets or sets the result of an operation or the name of a destination file.

This property may be updated with the current settings, or used to change the current settings for the TWAIN file system, based on the value of the FileMsg parameter of the QueryFileSystem method.

See Also

Elements | QueryFileSystem method, FileSystemInfo property, InputName property, Recursive property, FileType property, FileSize property, CreateTimeDate property, ModifiedTimeDate property, FreeMediaSpace property, NewImageSize property, NumberOfFiles property, NumberOfAudioSnippets property, DeviceGroupMask property
Topic: | TWAIN Functionality: Getting or Setting TWAIN File System Information


Recursive property (IFileSystem)

Visual Basic example

Visual C++ example

Syntax | BOOL Recursive
Overview | Refer to Getting or Setting TWAIN File System Information

Remarks

Enables or disables applying an action recursively. Possible values are:

Value | Meaning
TRUE | Apply the action recursively
FALST | Don’t apply the action recursively

This property may be updated with the current settings, or used to change the current settings for the TWAIN file system, based on the value of the FileMsg parameter of the QueryFileSystem method.

See Also

Elements | QueryFileSystem method, FileSystemInfo property, InputName property, OutputName property, FileType property, FileSize property, CreateTimeDate property, ModifiedTimeDate property, FreeMediaSpace property, NewImageSize property, NumberOfFiles property, NumberOfAudioSnippets property, DeviceGroupMask property
Topics | TWAIN Functionality: Getting or Setting TWAIN File System Information


CapArray property (ILEADTwainCapability Interface)

Visual Basic Example

Syntax | ICapabilityArray2 * CapArray
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

References an ICapabilityArray2 interface, which represents the array container of a capability.

This property is used only if CapInfo.ConType is L_TWON_ARRAY. This lets you get or set the array container of a capability.

See Also

Elements | ArrayCapValue property, ArrayItemType property, ArrayNumOfItems property, ConType property, CapInfo property, CapEnum property, CapOneValue property, CapRange property, EnableMethodErrors property
Topics | TWAIN Functionality: Image Functions


CapEnum property (ILEADTwainCapability Interface)

Visual Basic Example

Syntax | ICapabilityEnumeration2 * CapEnum
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

References an ICapabilityEnumeration2 interface, which represents the enumeration container of a capability.

This property is used only if CapInfo.ConType is L_TWON_ENUMERATION. This lets you get or set the enumeration container of a capability.

See Also

Elements | EnumCapValue property, EnumCurrentIndex property, EnumDefaultIndex property, EnumItemType property, EnumNumOfItems property, ConType property, CapArray property, CapInfo property, CapOneValue property, CapRange property, EnableMethodErrors property
Topics | TWAIN Functionality: Image Functions


CapInfo property (ILEADTwainCapability Interface)

Visual Basic Example

Syntax | ICapability2 * CapInfo
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

References an ICapability2 interface.

To set a capability, update the Capability property (if the capability constant is a short value) or the CapabilityLong property (if the capability constant is a long value), as well as the ConType property of the ICapability2 interface using the CapInfo property. Based on the value set in the ConType property of the ICapability2 interface, the container for the capability can be set using one of the following properties:

CapArray property

CapEnum property

CapOneValue property

CapRange property

Once all appropriate properties are set, call the SetCapability2 method to set the capability.

To get a capability, set the Capability property (if the capability constant is a short value) or the CapabilityLong property (if the capability constant is a long value), as well as the ConType property of the ICapability2 interface. You can set the ConType property to L_TWON_DONTCARE16 since it will be updated with the type of the retrieved capability. Call the GetCapability2 method. This will update the ConType property with the type of the retrieved capability. Based on the value of the ConType property of the ICapability2 interface, the container for the capability can be obtained using one of the following properties:

CapArray property

CapEnum property

CapOneValue property

CapRange property

See Also

Elements | Capability property, ConType property, CapArray property, CapEnum property, CapOneValue property, CapRange property, CapabilityLong property
Topics | TWAIN Functionality: Image Functions


CapRange property (ILEADTwainCapability Interface)

Visual Basic Example

Syntax | ICapabilityRange2 * CapRange
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

References an ICapabilityRange2 interface, which represents the range container of a capability.

This property is used only if CapInfo.ConType is L_TWON_RANGE. This lets you get or set the range container of a capability.

See Also

Elements | RangeCurrentValue property, RangeDefaultValue property, RangeItemType property, RangeMaximumValue property, RangeMinimumValue property, RangeStepSize property, ConType property, CapArray property, CapInfo property, CapEnum property, CapOneValue property, EnableMethodErrors property
Topics | TWAIN Functionality: Image Functions


CapOneValue property (ILEADTwainCapability Interface)

Visual Basic Example

Syntax | ICapabilityOneValue2 * CapOneValue
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

References an ICapabilityOneValue2 interface, which represents the one value container of a capability.

This property is used only if CapInfo.ConType is L_TWON_ONEVALUE. This lets you get or set the one value container of a capability.

See Also

Elements | OneValCapValue property, OneValItemType property, ConType property, CapArray property, CapInfo property, CapEnum property, CapRange property, EnableMethodErrors property
Topics | TWAIN Functionality: Image Functions


EnableMethodErrors property (ILEADTwainCapability)

EnableMethodErrors property (ILEADTwainCapability Interface)

Visual Basic Example

Syntax | VARIANT_BOOL EnableMethodErrors
Overview | Refer to How to Work with the Containers – Visual Basic.

Remarks

Specifies whether LEADTOOLS generates system error events (in addition to error return codes). Possible values are:

Setting | Description
TRUE | Generates system error events.
FALSE | Does not generate system error events.

See Also

Elements:

CapInfo property, CapArray property, CapEnum property, CapOneValue property, CapRange property


BufferMemoryCompression property (ILTDataTransfer)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long BufferMemoryCompression
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the value indicating the compression to be used when the TransferMode property is set to Memory Buffered Transfer Mode (L_TWSX_MEMORY). Possible values are (according to the TWAIN 1.9 specification):

Value | Meaning
L_TWCP_NONE | No compression is to be used.
L_TWCP_PACKBITS | Pack Bits compression.
L_TWCP_GROUP31D | CCITT Group 3 compression with no End of Line.
L_TWCP_GROUP31DEOL | CCITT Group 3 compression with End of Line.
L_TWCP_GROUP32D | CCITT Group 3 compression (use cap for K Factor).
L_TWCP_GROUP4 | CCITT Group 4 compression.
L_TWCP_JPEG | JPEG compression.
L_TWCP_LZW | LZW compression (like gifs).
L_TWCP_JBIG | JBIG compression, used mostly for bi-tonal images.
L_TWCP_PNG | PNG compressed.
L_TWCP_RLE4 | RLE4 compression.
L_TWCP_RLE8 | RLE8 compression.
L_TWCP_BITFIELDS | Bit Fields compression.

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the data transfer options, set this property and the other ILTDataTransfer properties accessed by the DataTransfer property and call the SetProperties method.

See Also

Elements | DataTransfer property, FillOrder property, TransferMode property, ScanFileFormat property, MemoryBufferSize property, EnableSaveMultipageFile property, EnableAppendToFile property, EnableDumpMemoryBuffersToFile property, GetProperties method, SetProperties method
Topics | TWAIN Functionality: Driver Settings


EnableAppendToFile property (ILTDataTransfer)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | VARIANT_BOOL EnableAppendToFile
Overview | Refer to Getting and Setting Capabilities

Remarks

Enables or disables appending pages to the end of the file when saving a multi-page file. Possible values are:

Setting | Description
TRUE | Append pages to the end of the file.
FALSE | Do not append pages to the end of the file.

This property is valid only when the TransferMode property is set to L_TWSX_FILE.

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the data transfer options, set this property and the other ILTDataTransfer properties accessed by the DataTransfer property and call the SetProperties method.

See Also

Elements | DataTransfer property, FillOrder property, BufferMemoryCompression property, TransferMode property, ScanFileFormat property, MemoryBufferSize property, EnableSaveMultipageFile property, EnableDumpMemoryBuffersToFile property, GetProperties method, SetProperties method
Topics | TWAIN Functionality: Driver Settings


EnableDumpMemoryBuffersToFile property (ILTDataTransfer)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | VARIANT_BOOL EnableDumpMemoryBuffersToFile
Overview | Refer to Getting and Setting Capabilities

Remarks

Enables or disables the use the file name specified in the FileTransferName property to dump the memory buffers received from the scanner. Possible values are:

Setting | Description
TRUE | Enables file name usage.
FALSE | Disables file name usage.

This property is valid only when the TransferMode property is set to L_TWSX_MEMORY.

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the data transfer options, set this property and the other ILTDataTransfer properties accessed by the DataTransfer property and call the SetProperties method.

See Also

Elements | DataTransfer property, FillOrder property, BufferMemoryCompression property, TransferMode property, ScanFileFormat property, MemoryBufferSize property, EnableSaveMultipageFile property, EnableAppendToFile property, GetProperties method, SetProperties method
Topics | TWAIN Functionality: Driver Settings


EnableSaveMultipageFile property (ILTDataTransfer)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | VARIANT_BOOL EnableSaveMultipageFile
Overview | Refer to Getting and Setting Capabilities

Remarks

Enables or disables saving multiple pages to a single file. Possible values are:

Setting | Description
TRUE | Enables saving to a single file.
FALSE | Disable saving to a single file. (Save each page to a separate file. The naming and numbering of the separate files is handled by the driver itself.)

This property is valid only when the TransferMode property is set to L_TWSX_FILE.

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the data transfer options, set this property and the other ILTDataTransfer properties accessed by the DataTransfer property and call the SetProperties method.

See Also

Elements | DataTransfer property, FillOrder property, BufferMemoryCompression property, TransferMode property, ScanFileFormat property, MemoryBufferSize property, EnableAppendToFile property, EnableDumpMemoryBuffersToFile property, GetProperties method, SetProperties method
Topics | TWAIN Functionality: Driver Settings


FillOrder property (ILTDataTransfer)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short FillOrder
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the value indicating how bytes in the image are to be transferred by the TWAIN source. Possible values are (according to the TWAIN 1.9 specification):

Value | Meaning
L_TWBO_LSBFIRST | Bytes are transferred with the least significant byte first.
L_TWBO_MSBFIRST | Bytes are transferred with the most significant byte first.

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the data transfer options, set this property and the other ILTDataTransfer properties accessed by the DataTransfer property and call the SetProperties method.

See Also

Elements | DataTransfer property, BufferMemoryCompression property, TransferMode property, ScanFileFormat property, MemoryBufferSize property, EnableSaveMultipageFile property, EnableAppendToFile property, EnableDumpMemoryBuffersToFile property, GetProperties method, SetProperties method
Topics | TWAIN Functionality: Driver Settings


MemoryBufferSize property (ILTDataTransfer)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long MemoryBufferSize
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets or sets the memory buffer size to be used in data transfer.

This property is valid only when the TransferMode property is set to L_TWSX_MEMORY.

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the data transfer options, set this property and the other ILTDataTransfer properties accessed by the DataTransfer property and call the SetProperties method.

See Also

Elements | DataTransfer property, FillOrder property, BufferMemoryCompression property, TransferMode property, ScanFileFormat property, EnableSaveMultipageFile property, EnableAppendToFile property, EnableDumpMemoryBuffersToFile property, GetProperties method, SetProperties method, GetCapability method, GetCapability2 method, QueryCapability method
Topics | TWAIN Functionality: Driver Settings


ScanFileFormat property (ILTDataTransfer)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short ScanFileFormat
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets or sets the value indicating 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
L_TWFF_TIFF | Tagged image file.
L_TWFF_PICT | Macintosh PICT.
L_TWFF_BMP | Windows regular bitmap.
L_TWFF_XBM | X-Windows bitmap.
L_TWFF_JFIF | JPEG file interchange format.
L_TWFF_FPX | Flash pix file.
L_TWFF_TIFFMULTI | Multi-page tiff file format.
L_TWFF_PNG | PNG file.
L_TWFF_SPIFF | SPIFF file.
L_TWFF_EXIF | EXIF file.

This property is valid only when the TransferMode property is set to L_TWSX_FILE.

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the data transfer options, set this property and the other ILTDataTransfer properties accessed by the DataTransfer property and call the SetProperties method.

When saving data to the file specified in the FileTransferName property, the ScanFileFormat property determines the file format of the saved file.

See Also

Elements | DataTransfer property, FillOrder property, BufferMemoryCompression property, TransferMode property, MemoryBufferSize property, EnableSaveMultipageFile property, EnableAppendToFile property, EnableDumpMemoryBuffersToFile property, GetProperties method, SetProperties method
Topics | TWAIN Functionality: Driver Settings.


TransferMode property (ILTDataTransfer)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long TransferMode
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets or sets the value indicating the transfer mode to be used by the TWAIN source. Possible values are (according to the TWAIN 1.9 specification):

Value | Meaning
L_TWSX_NATIVE | Native transfer mode.
L_TWSX_MEMORY | Memory buffered transfer mode. The source will transfer strips of data to the application based on the memory buffer size. The memory buffer size can be found in the MemoryBufferSize property.
L_TWSX_FILE | File transfer mode. The TWAIN source will transfer the data to a specific file with a specific format. The name of the file is contained in the FileTransferName property and the file format is given in the ScanFileFormat property.

This property is updated with the driver’s current setting when the GetProperties method is called.

If this property is set to L_TWSX_NATIVE, then all other ILTDataTransfer properties are considered invalid.

To update the data transfer options, set this property and the other ILTDataTransfer properties accessed by the DataTransfer property and call the SetProperties method.

See Also

Elements | DataTransfer property, FillOrder property, BufferMemoryCompression property, ScanFileFormat property, MemoryBufferSize property, EnableSaveMultipageFile property, EnableAppendToFile property, EnableDumpMemoryBuffersToFile property, GetProperties method, SetProperties method
Topics | TWAIN Functionality: Driver Settings


BitsPerPixel Property (ILTFastConfig)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short BitsPerPixel
Overview | Refer to Fast TWAIN (Scan Configurations)

Remarks

Gets the bits per pixel that will be used for this configuration.

See Also

Elements | TransferMode property, FileFormat property, BufferSize property, RequiredTime property
Topics | Twain Functionality: Fast TWAIN (Scan Configurations)


BufferSize Property (ILTFastConfig)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long BufferSize
Overview | Refer to Fast TWAIN (Scan Configurations)

Remarks

Gets or sets the buffer size of the scan configuration referenced by this ILTFastConfig interface.

If this property value is zero, then it means to use the Twain driver preferred buffer size, otherwise it is the actual buffer size.

See Also

Elements | TransferMode property, FileFormat property, RequiredTime property, BitsPerPixel property
Topics | Twain Functionality: Fast TWAIN (Scan Configurations)


FileFormat Property (ILTFastConfig)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short FileFormat
Overview | Refer to Fast TWAIN (Scan Configurations)

Remarks

Gets or sets the file format for the scan configuration referenced by this ILTFastConfig interface.

See Also

Elements | TransferMode property, BufferSize property, RequiredTime property, BitsPerPixel property
Topics | Twain Functionality: Fast TWAIN (Scan Configurations)


Success Property (ILTFastConfig)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | BOOL Success
Overview | Refer to Fast TWAIN (Scan Configurations)

Remarks

(Read only) Gets the success status for the scan configuration, referenced by this ILTFastConfig interface, which is currently being tested. Possible values are:

Value | Meaning
TRUE | The current scan configuration was successful.
FALSE | The current scan configuration was not successful.

See Also

Elements | TransferMode property, FileFormat property, BufferSize property, BitsPerPixel property, RequiredTime property
Topics | Twain Functionality: Fast TWAIN (Scan Configurations)


TransferMode Property (ILTFastConfig)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short TransferMode
Overview | Refer to Fast TWAIN (Scan Configurations)

Remarks

Gets or sets the transfer mode of the scan configuration referenced by this ILTFastConfig interface. Possible values are:

Value | Meaning
L_LTWAIN_FILE_MODE | [0x001] Use File transfer mode
L_LTWAIN_BUFFER_MODE | [0x002] Use Memory transfer mode
L_LTWAIN_NATIVE_MODE | [0x004] Use Native transfer mode

See Also

Elements | FileFormat property, BufferSize property, RequiredTime property, BitsPerPixel property
Topics | Twain Functionality: Fast TWAIN (Scan Configurations)


RequiredTime Property (ILTFastConfig)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long RequiredTime
Overview | Refer to Fast TWAIN (Scan Configurations)

Remarks

Gets 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.

See Also

Elements | TransferMode property, FileFormat property, BufferSize property, BitsPerPixel property
Topics | Twain Functionality: Fast TWAIN (Scan Configurations)


Brightness property (ILTImageEffects)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | float Brightness
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets or sets the brightness value to apply to the image being scanned.

This property is equivalent to the ICAP_BRIGHTNESS capability. There are two ways of determining the possible values for this capability:

call the QueryCapability method with pCapability. Capability set to ICAP_BRIGHTNESS.

call the GetCapability method (MFC) or the GetCapability2 method (VB) with pCapability. Capability set to ICAP_BRIGHTNESS and the IFlags parameter set to L_LTWAIN_CAPABILITY_GETVALUES.

For more information on specific TWAIN capabilities, refer to the TWAIN 1.9 specification.

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the image effect options, set this property and the other ILTImageEffects properties accessed by the ImageEffects property and call the SetProperties method.

See Also

Elements | ImageEffects property, PixelFlavor property, ColorScheme property, HighLight property, Shadow property, Contrast property, HalfTone property, GetProperties method, SetProperties method, GetCapability method, GetCapability2 method, QueryCapability method
Topics | TWAIN Functionality: Driver Settings


ColorScheme property (ILTImageEffects)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short ColorScheme
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets or sets the value indicating the color scheme to use when scanning in an image. Possible values are (according to the TWAIN 1.9 specification):

Value | Meaning
L_TWPT_BW | Black and White (1 bit).
L_TWPT_GRAY | 8-bit Gray Scale
L_TWPT_RGB | 24-bit RGB Color.
L_TWPT_PALETTE | 8-bit Color.
L_TWPT_CMY | CYAN, magenta, yellow color space.
L_TWPT_CMYK | CYAN, magenta, yellow, black color space.
L_TWPT_YUV | Color space type that is true color encoding. It uses one luminance value (Y) and two chroma values (UV).
L_TWPT_YUVK | The same as YUV with an additional black variable.
L_TWPT_CIEXYZ | Chromaticity diagram.

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the image effect options, set this property and the other ILTImageEffects properties accessed by the ImageEffects property and call the SetProperties method.

See Also

Elements | ImageEffects property, PixelFlavor property, HighLight property, Shadow property, Brightness property, Contrast property, HalfTone property, GetProperties method, SetProperties method
Topics | TWAIN Functionality: Driver Settings


Contrast property (ILTImageEffects)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | float Contrast
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets or sets the contrast value to apply to the image being scanned.

This property is equivalent to the ICAP_CONTRAST capability. There are two ways of determining the possible values for this capability:

call the QueryCapability method with pCapability. Capability set to ICAP_CONTRAST.

call the GetCapability method (MFC) or the GetCapability2 method (VB) with pCapability. Capability set to ICAP_CONTRAST and the IFlags parameter set to L_LTWAIN_CAPABILITY_GETVALUES.

For more information on specific TWAIN capabilities, refer to the TWAIN 1.9 specification.

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the image effect options, set this property and the other ILTImageEffects properties accessed by the ImageEffects property and call the SetProperties method.

See Also

Elements | ImageEffects property, PixelFlavor property, ColorScheme property, HighLight property, Shadow property, Brightness property, HalfTone property, GetProperties method, SetProperties method, GetCapability method, GetCapability2 method, QueryCapability method
Topics | TWAIN Functionality: Driver Settings


HalfTone property (ILTImageEffects)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | BSTR HalfTone
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets or sets the name of the pattern to apply to the image being scanned.

This property is equivalent to the ICAP_BITDEPTHREDUCTION capability. There are two ways of determining the possible values for this capability:

call the QueryCapability method with pCapability. Capability set to ICAP_BITDEPTHREDUCTION.

call the GetCapability method (MFC) or the GetCapability2 method (VB) with pCapability. Capability set to ICAP_BITDEPTHREDUCTION and the IFlags parameter set to L_LTWAIN_CAPABILITY_GETVALUES.

For more information on specific TWAIN capabilities, refer to the TWAIN 1.9 specification.

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the image effect options, set this property and the other ILTImageEffects properties accessed by the ImageEffects property and call the SetProperties method.

See Also

Elements | ImageEffects property, PixelFlavor property, ColorScheme property, HighLight property, Shadow property, Brightness property, Contrast property, GetProperties method, SetProperties method, GetCapability method, GetCapability2 method, QueryCapability method
Topics | TWAIN Functionality: Driver Settings


HighLight property (ILTImageEffects)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | float HighLight
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets or sets the highlight value to apply to the image being scanned.

This property is equivalent to the ICAP_HIGHLIGHT capability. There are two ways of determining the possible values for this capability:

call the QueryCapability method with pCapability. Capability set to ICAP_HIGHLIGHT.

call the GetCapability method (MFC) or the GetCapability2 method (VB) with pCapability. Capability set to ICAP_HIGHLIGHT and the IFlags parameter set to L_LTWAIN_CAPABILITY_GETVALUES.

For more information on specific TWAIN capabilities, refer to the TWAIN 1.9 specification.

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the image effect options, set this property and the other ILTImageEffects properties accessed by the ImageEffects property and call the SetProperties method.

See Also

Elements | ImageEffects property, PixelFlavor property, ColorScheme property, Shadow property, Brightness property, Contrast property, HalfTone property, GetProperties method, SetProperties method, GetCapability method, GetCapability2 method, QueryCapability method
Topics | TWAIN Functionality: Driver Settings


PixelFlavor property (ILTImageEffects)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short PixelFlavor
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets or sets the value indicating the pixel flavor used when acquiring an image from a TWAIN source. Possible values are (according to the TWAIN 1.9 specification):

Value | Meaning
L_TWPF_CHOCOLATE | Zero stands for the darkest shade.
L_TWPF_VANILLA | Zero stands for the lightest shade.

This property is updated with the current setting when the GetProperties method is called.

To update the image effect options, set this property and the other ILTImageEffects properties accessed by the ImageEffects property and call the SetProperties method.

See Also

Elements | ImageEffects property, ColorScheme property, HighLight property, Shadow property, Brightness property, Contrast property, HalfTone property, GetProperties method, SetProperties method
Topics | TWAIN Functionality: Driver Settings


Shadow property (ILTImageEffects)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | float Shadow
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets or sets the shadow value to apply to the image being scanned.

This property is equivalent to the ICAP_SHADOW capability. There are two ways of determining the possible values for this capability:

call the QueryCapability method with pCapability. Capability set to ICAP_SHADOW.

call the GetCapability method (MFC) or the GetCapability2 method (VB) with pCapability. Capability set to ICAP_SHADOW and the IFlags parameter set to L_LTWAIN_CAPABILITY_GETVALUES.

For more information on specific TWAIN capabilities, refer to the TWAIN 1.9 specification.

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the image effect options, set this property and the other ILTImageEffects properties accessed by the ImageEffects property and call the SetProperties method.

See Also

Elements | ImageEffects property, PixelFlavor property, ColorScheme property, HighLight property, Brightness property, Contrast property, HalfTone property, GetProperties method, SetProperties method, GetCapability method, GetCapability2 method, QueryCapability method
Topics | TWAIN Functionality: Driver Settings


BitsPerPixel property (ILTImageResolution)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short BitsPerPixel
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the bits per pixel for the acquired image(s).

This property is equivalent to the ICAP_BITDEPTH capability. There are two ways of determining the possible values for this capability:

call the QueryCapability method with pCapability. Capability set to ICAP_BITDEPTH.

call the GetCapability method (MFC) or the GetCapability2 method (VB) with pCapability. Capability set to ICAP_BITDEPTH and the IFlags parameter set to L_LTWAIN_CAPABILITY_GETVALUES.

For more information on specific TWAIN capabilities, refer to the TWAIN 1.9 specification.

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the image resolution options, set this property and the other ILTImageResolution properties accessed by the ImageResolution property and call the SetProperties method.

See Also

Elements | ImageResolution property, Unit property, HorizontalResolution property, VerticalResolution property, XScaling property, YScaling property, RotationAngle property, GetProperties method, SetProperties method, GetCapability method, GetCapability2 method, QueryCapability method
Topics | TWAIN Functionality: Driver Settings


HorizontalResolution property (ILTImageResolution)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | float HorizontalResolution
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets or sets the horizontal resolution of the TWAIN source while acquiring the images.

The unit of measure for this property is determined by the Unit property.

This property is equivalent to the ICAP_XRESOLUTION capability. There are two ways of determining the possible values for this capability:

call the QueryCapability method with pCapability. Capability set to ICAP_XRESOLUTION.

call the GetCapability method (MFC) or the GetCapability2 method (VB) with pCapability. Capability set to ICAP_XRESOLUTION and the IFlags parameter set to L_LTWAIN_CAPABILITY_GETVALUES.

For more information on specific TWAIN capabilities, refer to the TWAIN 1.9 specification.

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the image resolution options, set this property and the other ILTImageResolution properties accessed by the ImageResolution property and call the SetProperties method.

See Also

Elements | ImageResolution property, Unit property, BitsPerPixel property, VerticalResolution property, XScaling property, YScaling property, RotationAngle property, GetProperties method, SetProperties method, GetCapability method, GetCapability2 method, QueryCapability method
Topics | TWAIN Functionality: Driver Settings


RotationAngle property (ILTImageResolution)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | float RotationAngle
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets or sets the angle of rotation of the acquired image, before transfer. This value is measured in degrees. Valid values range from –360 to +360 degrees.

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the image resolution options, set this property and the other ILTImageResolution properties accessed by the ImageResolution property and call the SetProperties method.

See Also

Elements | ImageResolution property, Unit property, BitsPerPixel property, HorizontalResolution property, VerticalResolution property, XScaling property, YScaling property, GetProperties method, SetProperties method, GetCapability method, GetCapability2 method, QueryCapability method
Topics | TWAIN Functionality: Driver Settings


Unit property (ILTImageResolution)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short Unit
Overview | Refer to Getting and Setting Capabilities.

Remarks

Gets or sets the unit of measure to use. Possible values are (according to the TWAIN 1.9 specification):

Value | Meaning
L_TWUN_INCHES | Inches unit.
L_TWUN_CENTIMETERS | Centimeters unit.
L_TWUN_PICAS | Picas unit.
L_TWUN_POINTS | Points unit.
L_TWUN_TWIPS | Twips unit.
L_TWUN_PIXELS | Pixels unit.

The value of this property indicates the unit of measure for the following properties:

HorizontalResolution property

VerticalResolution property

BottomMargin property

LeftMargin property

RightMargin property

TopMargin property

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the image resolution options, set this property and the other ILTImageResolution properties accessed by the ImageResolution property and call the SetProperties method.

See Also

Elements | ImageResolution property, BitsPerPixel property, HorizontalResolution property, VerticalResolution property, XScaling property, YScaling property, RotationAngle property, GetProperties method, SetProperties method
Topics | TWAIN Functionality: Driver Settings


VerticalResolution property (ILTImageResolution)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | float VerticalResolution
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the vertical resolution of the TWAIN source while acquiring the images.

The unit of measure for this property is determined by the Unit property.

This property is equivalent to the ICAP_YRESOLUTION capability. There are two ways of determining the possible values for this capability:

call the QueryCapability method with pCapability. Capability set to ICAP_YRESOLUTION.

call the GetCapability method (MFC) or the GetCapability2 method (VB) with pCapability. Capability set to ICAP_YRESOLUTION and the IFlags parameter set to L_LTWAIN_CAPABILITY_GETVALUES.

For more information on specific TWAIN capabilities, refer to the TWAIN 1.9 specification.

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the image resolution options, set this property and the other ILTImageResolution properties accessed by the ImageResolution property and call the SetProperties method.

See Also

Elements | ImageResolution property, Unit property, BitsPerPixel property, HorizontalResolution property, XScaling property, YScaling property, RotationAngle property, GetProperties method, SetProperties method, GetCapability method, GetCapability2 method, QueryCapability method
Topics | TWAIN Functionality: Driver Settings


XScaling property (ILTImageResolution)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | float XScaling
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the horizontal scaling value of the acquired image, before transfer.

This value is expressed as a percentage, with 1.0 corresponding to 100%, 2.0 corresponding to 200%, etc.

This property is equivalent to the ICAP_XSCALING capability. There are two ways of determining the possible values for this capability:

call the QueryCapability method with pCapability. Capability set to ICAP_XSCALING.

call the GetCapability method (MFC) or the GetCapability2 method (VB) with pCapability. Capability to ICAP_XSCALING and the IFlags parameter set to L_LTWAIN_CAPABILITY_GETVALUES.

For more information on specific TWAIN capabilities, refer to the TWAIN 1.9 specification.

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the image resolution options, set this property and the other ILTImageResolution properties accessed by the ImageResolution property and call the SetProperties method.

See Also

Elements | ImageResolution property, Unit property, BitsPerPixel property, HorizontalResolution property, VerticalResolution property, YScaling property, RotationAngle property, GetProperties method, SetProperties method, GetCapability method, GetCapability2 method, QueryCapability method
Topics | TWAIN Functionality: Driver Settings


YScaling property (ILTImageResolution)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | float YScaling
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the vertical scaling value of the acquired image, before transfer.

This value is expressed as a percentage, with 1.0 corresponding to 100%, 2.0 corresponding to 200%, etc.

This property is equivalent to the ICAP_YSCALING capability. There are two ways of determining the possible values for this capability:

call the QueryCapability method with pCapability. Capability set to ICAP_YSCALING.

call the GetCapability method (MFC) or the GetCapability2 method (VB) with pCapability. Capability set to ICAP_YSCALING and the IFlags parameter set to L_LTWAIN_CAPABILITY_GETVALUES.

For more information on specific TWAIN capabilities, refer to the TWAIN 1.9 specification.

This property is updated with the driver’s current setting when the GetProperties method is called.

To update the image resolution options, set this property and the other ILTImageResolution properties accessed by the ImageResolution property and call the SetProperties method.

See Also

Elements | ImageResolution property, Unit property, BitsPerPixel property, HorizontalResolution property, VerticalResolution property, XScaling property, RotationAngle property, GetProperties method, SetProperties method, GetCapability method, GetCapability2 method, QueryCapability method
Topics | TWAIN Functionality: Driver Settings


Channel1 property (ITwainRGBElements)

Visual Basic example

Visual C++ example

Syntax | short Channel1
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the first tri-stimulus value (e.g. Red channel).

To update the RGB elements data, set this property and the other ITwainRGBElements properties accessed by the RGBElements property and call the SetRGBResponse method.

See Also

Elements | Index Property, Channel2 Property, Channel3 property, SetRGBResponse method, RGBElements property
Topics | TWAIN Functionality: Capability Functions


Channel2 property (ITwainRGBElements)

Visual Basic example

Visual C++ example

Syntax | short Channel2
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the second tri-stimulus value (e.g. Green channel).

To update the RGB elements data, set this property and the other ITwainRGBElements properties accessed by the RGBElements property and call the SetRGBResponse method.

See Also

Elements | Index Property, Channel1 Property, Channel3 property, SetRGBResponse method, RGBElements property
Topics | TWAIN Functionality: Capability Functions


Channel3 property (ITwainRGBElements)

Visual Basic example

Visual C++ example

Syntax | short Channel3
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the third tri-stimulus value (e.g. Blue channel).

To update the RGB elements data, set this property and the other ITwainRGBElements properties accessed by the RGBElements property and call the SetRGBResponse method.

See Also

Elements | Index Property, Channel1 Property, Channel2 Property, SetRGBResponse method, RGBElements property
Topics | TWAIN Functionality: Capability Functions


Index property (ITwainRGBElements)

Visual Basic example

Visual C++ example

Syntax | short Index
Overview | Refer to Getting and Setting Capabilities

Remarks

Gets or sets the index into the color table.

To update the RGB elements data, set this property and the other ITwainRGBElements properties accessed by the RGBElements property and call the SetRGBResponse method.

See Also

Elements | Channel1 Property, Channel2 Property, Channel3 property, SetRGBResponse method, RGBElements property
Topics | TWAIN Functionality: Capability Functions


ColorSpace property (ITwainJpegCompression)

Visual Basic example

Visual C++ example

Syntax | short ColorSpace
Overview | Refer to Using JPEG Compression for a TWAIN Source.

Remarks

Gets or sets a value that indicates the color space in which the compressed components are stored. Only spaces supported by the source for L_ICAP_JPEGPIXELTYPE are valid.

This property is updated by calling the GetJPEGCompression method.

To set the JPEG Compression options, set this property and the other ITwainJpegCompression properties accessed by the JPEGCompressionData property and call the SetJPEGCompression method.

For more information on L_ICAP_JPEGPIXELTYPE, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

See Also

Elements | JPEGCompressionData property, SubSampling property, NumComponents property, RestartFrequency property, QuantMap property, QuantTable property, HuffmanMap property, HuffmanDC property, HuffmanAC property
Topics | TWAIN Functionality: JPEG Compression Functions


HuffmanAC property (ITwainJpegCompression)

Visual Basic example

Visual C++ example

Syntax | ITwainMemoryData* HuffmanAC(short iIndex)
Overview | Refer to Using JPEG Compression for a TWAIN Source.

Remarks

Gets or sets AC Huffman tables.

This property is updated by calling the GetJPEGCompression method.

This property is an array of pointers to ITwainMemoryData objects. Each ITwainMemoryData object contains the following properties:

Flags property

Length property

Data property

To set the JPEG Compression options, set the sub properties, listed above, of this property, and the other ITwainJpegCompression properties accessed by the JPEGCompressionData property and call the SetJPEGCompression method.

See Also

Elements | JPEGCompressionData property, ColorSpace property, SubSampling property, NumComponents property, RestartFrequency property, QuantMap property, QuantTable property, HuffmanMap property, HuffmanDC property
Topics | TWAIN Functionality: JPEG Compression Functions


HuffmanDC property (ITwainJpegCompression)

Visual Basic example

Visual C++ example

Syntax | ITwainMemoryData* HuffmanDC(short iIndex)
Overview | Refer to Using JPEG Compression for a TWAIN Source.

Remarks

Gets or sets DC Huffman tables.

This property is updated by calling the GetJPEGCompression method.

This property is an array of pointers to ITwainMemoryData objects. Each ITwainMemoryData object contains the following properties:

Flags property

Length property

Data property

To set the JPEG Compression options, set the sub properties, listed above, of this property, and the other ITwainJpegCompression properties accessed by the JPEGCompressionData property and call the SetJPEGCompression method.

See Also

Elements | JPEGCompressionData property, ColorSpace property, SubSampling property, NumComponents property, RestartFrequency property, QuantMap property, QuantTable property, HuffmanMap property, HuffmanAC property
Topics | TWAIN Functionality: JPEG Compression Functions


HuffmanMap property (ITwainJpegCompression)

Visual Basic example

Visual C++ example

Syntax | short HuffmanMap(short iIndex)
Overview | Refer to Using JPEG Compression for a TWAIN Source.

Remarks

Gets or sets information about the mapping of components to Huffman tables.

This property is updated by calling the GetJPEGCompression method.

To set the JPEG Compression options, set this property and the other ITwainJpegCompression properties accessed by the JPEGCompressionData property and call the SetJPEGCompression method.

See Also

Elements | JPEGCompressionData property, ColorSpace property, SubSampling property, NumComponents property, RestartFrequency property, QuantMap property, QuantTable property, HuffmanDC property, HuffmanAC property
Topics | TWAIN Functionality: JPEG Compression Functions


NumComponents property (ITwainJpegCompression)

Visual Basic example

Visual C++ example

Syntax | short NumComponents
Overview | Refer to Using JPEG Compression for a TWAIN Source.

Remarks

Gets or sets the number of color components in the image to be compressed.

This property is updated by calling the GetJPEGCompression method.

To set the JPEG Compression options, set this property and the other ITwainJpegCompression properties accessed by the JPEGCompressionData property and call the SetJPEGCompression method.

For more information on color components, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

See Also

Elements | JPEGCompressionData property, ColorSpace property, SubSampling property, RestartFrequency property, QuantMap property, QuantTable property, HuffmanMap property, HuffmanDC property, HuffmanAC property
Topics | TWAIN Functionality: JPEG Compression Functions


QuantMap property (ITwainJpegCompression)

Visual Basic example

Visual C++ example

Syntax | short QuantMap(short iIndex)
Overview | Refer to Using JPEG Compression for a TWAIN Source.

Remarks

Gets or sets information about the mapping of components to quantization tables.

This property is updated by calling the GetJPEGCompression method.

To set the JPEG Compression options, set this property and the other ITwainJpegCompression properties accessed by the JPEGCompressionData property and call the SetJPEGCompression method.

See Also

Elements | JPEGCompressionData property, ColorSpace property, SubSampling property, NumComponents property, RestartFrequency property, QuantTable property, HuffmanMap property, HuffmanDC property, HuffmanAC property
Topics | TWAIN Functionality: JPEG Compression Functions


QuantTable property (ITwainJpegCompression)

Visual Basic example

Visual C++ example

Syntax | ITwainMemoryData* QuantTable(short iIndex)
Overview | Refer to Using JPEG Compression for a TWAIN Source.

Remarks

Gets or sets quantization tables.

This property is updated by calling the GetJPEGCompression method.

This property is an array of pointers to ITwainMemoryData objects. Each ITwainMemoryData object contains the following properties:

Flags property

Length property

Data property

To set the JPEG Compression options, set the sub properties, listed above, of this property, and the other ITwainJpegCompression properties accessed by the JPEGCompressionData property and call the SetJPEGCompression method.

See Also

Elements | JPEGCompressionData property, ColorSpace property, SubSampling property, NumComponents property, RestartFrequency property, QuantMap property, HuffmanMap property, HuffmanDC property, HuffmanAC property
Topics | TWAIN Functionality: JPEG Compression Functions


RestartFrequency property (ITwainJpegCompression)

Visual Basic example

Visual C++ example

Syntax | short RestartFrequency
Overview | Refer to Using JPEG Compression for a TWAIN Source.

Remarks

Gets or sets the number of minimum data units between restart markers. The default value is 0, indicating that no restart markers are used.

This property is updated by calling the GetJPEGCompression method.

To set the JPEG Compression options, set this property and the other ITwainJpegCompression properties accessed by the JPEGCompressionData property and call the SetJPEGCompression method.

For more information on data units and restart markers, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

See Also

Elements | JPEGCompressionData property, ColorSpace property, SubSampling property, NumComponents property, QuantMap property, QuantTable property, HuffmanMap property, HuffmanDC property, HuffmanAC property
Topics | TWAIN Functionality: JPEG Compression Functions


SubSampling property (ITwainJpegCompression)

Visual Basic example

Visual C++ example

Syntax | long SubSampling
Overview | Refer to Using JPEG Compression for a TWAIN Source.

Remarks

Gets or sets a subsampling value.

This property is updated by calling the GetJPEGCompression method.

To set the JPEG Compression options, set this property and the other ITwainJpegCompression properties accessed by the JPEGCompressionData property and call the SetJPEGCompression method.

For more information on subsampling, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

See Also

Elements | JPEGCompressionData property, ColorSpace property, NumComponents property, RestartFrequency property, QuantMap property, QuantTable property, HuffmanMap property, HuffmanDC property, HuffmanAC property
Topics | TWAIN Functionality: JPEG Compression Functions


Data property (ITwainMemoryData)

Visual Basic example

Visual C++ example

Syntax | long Data
Overview | Refer to Using JPEG Compression for a TWAIN Source.

Remarks

Gets or sets memory data.

The data type depends on the value of the Flags property.

This property is updated through the QuantTable, HuffmanDC and HuffmanAC properties by calling the GetJPEGCompression method.

This property is set through the QuantTable, HuffmanDC and HuffmanAC properties when the SetJPEGCompression method is called.

See Also

Elements | JPEGCompressionData property, Flags property, Length property
Topics | TWAIN Functionality: JPEG Compression Functions


Flags property (ITwainMemoryData)

Visual Basic example

Visual C++ example

Syntax | long Flags
Overview | Refer to Using JPEG Compression for a TWAIN Source.

Remarks

Gets or sets a value that identifies how the memory data in the Data property is presented. Possible values are:

Value | Description
TWMF_APPOWNS | [0x1] Memory data is application information.
TWMF_DSMOWNS | [0x2] Memory data is Twain data source manager information.
TWMF_DSOWNS | [0x4] Memory data is Twain data source information.
TWMF_POINTER | [0x8] Memory data is user data in a pointer.
TWMF_HANDLE | [0x10] Memory data is user data in a handle.

This property is updated through the QuantTable, HuffmanDC and HuffmanAC properties by calling the GetJPEGCompression method.

This property is set through the QuantTable, HuffmanDC and HuffmanAC properties when the SetJPEGCompression method is called.

See Also

Elements | JPEGCompressionData property, Length property, Data property
Topics | TWAIN Functionality: JPEG Compression Functions


Length property (ITwainMemoryData)

Visual Basic example

Visual C++ example

Syntax | long Length
Overview | Refer to Using JPEG Compression for a TWAIN Source.

Remarks

Gets or sets the size of the data buffer in bytes.

The value of this property should always be an even number and word-aligned.

This property is updated through the QuantTable, HuffmanDC and HuffmanAC properties by calling the GetJPEGCompression method.

This property is set through the QuantTable, HuffmanDC and HuffmanAC properties when the SetJPEGCompression method is called.

See Also

Elements | JPEGCompressionData property, Flags property, Data property
Topics | TWAIN Functionality: JPEG Compression Functions


NumOfInfos property (ItwExtImageInfo Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | long NumOfInfos
Overview | Refer to How to Acquire from the TWAIN Source.

Remarks

Gets or sets the number of items in the PtwInfo property of the ItwExtImageInfo interface.

Each time this property is set, the data in the ItwExtImageInfo interface is reset.

See Also

Topics

TWAIN Functionality: Image Functions


PtwInfo property (ItwExtImageInfo Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ItwInfo * PtwInfo (int nIndex)
Overview | Refer to How to Acquire from the TWAIN Source.

Remarks

(Read only) Pointer to an array of ItwInfo interfaces that contain the extended image information.

See Also

Topics

TWAIN Functionality: Image Functions


BottomMargin property (ItwFrame Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | float BottomMargin
Overview | Refer to How to Work with the Containers - MFC.

Remarks

Get or sets the bottom margin value of a TW_FRAME structure.

The TW_FRAME structure defines the area of the image to be acquired. For more information on the TW_FRAME structure, refer to the LEADTOOLS TWAIN Defines.

See Also

Elements | RightMargin property, LeftMargin property, TopMargin property.
Topics | TWAIN Functionality: Margin Functions


LeftMargin property (ItwFrame Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | float LeftMargin
Overview | Refer to How to Work with the Containers - MFC.

Remarks

Get or sets the left margin value of a TW_FRAME structure.

The TW_FRAME structure defines the area of the image to be acquired. For more information on the TW_FRAME structure, refer to the LEADTOOLS TWAIN Defines.

See Also

Elements | RightMargin property, TopMargin property, BottomMargin property.
Topics | TWAIN Functionality: Margin Functions


RightMargin property (ItwFrame Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | float RightMargin
Overview | Refer to How to Work with the Containers - MFC.

Remarks

Get or sets the right margin value of a TW_FRAME structure.

The TW_FRAME structure defines the area of the image to be acquired. For more information on the TW_FRAME structure, refer to the LEADTOOLS TWAIN Defines.

See Also

Elements | LeftMargin property, TopMargin property, BottomMargin property.
Topics | TWAIN Functionality: Margin Functions


TopMargin property (ItwFrame Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | float TopMargin
Overview | Refer to How to Work with the Containers - MFC.

Remarks

Get or sets the top margin value of a TW_FRAME structure.

The TW_FRAME structure defines the area of the image to be acquired. For more information on the TW_FRAME structure, refer to the LEADTOOLS TWAIN Defines.

See Also

Elements | RightMargin property, LeftMargin property, BottomMargin property.
Topics | TWAIN Functionality: Margin Functions


CondCode property (ItwInfo Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short CondCode
Overview | Refer to How to Acquire from the TWAIN Source.

Remarks

Gets or sets the condition code for retrieving the extended image information.

For more information on possible values, refer to LEADTOOLS TWAIN Defines.

See Also

Topics

TWAIN Functionality: Image Functions


InfoID property (ItwInfo Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short InfoID
Overview | Refer to How to Acquire from the TWAIN Source.

Remarks

Gets or sets the extended image information ID.

See Also

Elements | Item property, ItemType property
Topics | TWAIN Functionality: Image Functions


Item property (ItwInfo Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | ILEADRasterVariant *Item(int nIndex, int nParam1)
Overview | Refer to How to Acquire from the TWAIN Source.

Remarks

(Read only) An ILEADRasterVariant object that is updated with the extended image information.

See Also

Elements | InfoID property, ItemType property
Topics | TWAIN Functionality: Image Functions


ItemType property (ItwInfo Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short ItemType
Overview | Refer to How to Acquire from the TWAIN Source.

Remarks

Get or sets type of data contained in the extended image information. For a list of possible values, refer to the LEADTOOLS TWAIN Defines.

See Also

Elements | Item property, InfoID property
Topics | TWAIN Functionality: Image Functions


NumOfItems property (ItwInfo Interface)

Visual Basic Example

Visual C++ 5.0 Example

Syntax | short NumOfItems
Overview | Refer to How to Acquire from the TWAIN Source.

Remarks

Gets or sets the number of items retrieved for the extended image information.

See Also

Topics

TWAIN Functionality: Image Functions


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 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.


Document/Medical Support and Licensing Requirements

Document/Medical Licensing and Royalty Agreements:

Congratulations! You have licensed one of the LEADTOOLS Document/Medical software products, the most comprehensive imaging toolkits on the market, enabling you to create powerful imaging applications. The license terms for LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite require runtime licensing based on the number of copies of your application that you deploy (i.e., distribute or install and use internally).

By paying the initial box price for the applicable LEADTOOLS product, you have obtained a development license, which entitles you to develop your application and test it. Once completed, if you wish to distribute the application or deploy it internally on multiple machines, you are required to enter into a duplication and distribution agreement with LEAD. You have the ability to choose from several licensing options depending on your volume needs.

The product you are installing is a fully functional working version and includes support for all features in LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite. (Depending on which product you have licensed, some of the features may ultimately not be available to you. See the on-line help file for a product feature comparison.) Until you sign and return the correct licensing agreement, your application will display a "nag" message. Once LEAD receives the executed contract, we will provide you a password that will permit you to terminate the "nag" message for the product that you have licensed. In addition to providing the password, you must also use the no nag version of the LTR14N.DLL, found in the REDIST\COM\NONAG directory. This is also the version you must redistribute.

Duplication and Distribution Agreements

Click this button to start the Licensing help file to review the License Agreements governing your use of the software.


Syntax

This is the internal syntax of the property, method, or event. The external syntax depends on the development system you are using. Refer to the code example for your system, or for general information, refer to the following:

Visual Basic Syntax

Visual C++ 5.0 Syntax


Visual C++ Key Codes

The following are the Visual C++ key codes:

VK_A through VK_Z are the same as their ASCII equivalents: 'A' thru 'Z'.
VK_0 through VK_9 are the same as their ASCII equivalents: '0' thru '9'.
VK_LBUTTON
VK_RBUTTON
VK_CANCEL
VK_MBUTTON
VK_BACK
VK_TAB
VK_CLEAR
VK_RETURN
VK_SHIFT
VK_CONTROL
VK_MENU
VK_PAUSE
VK_CAPITAL
VK_ESCAPE
VK_SPACE
VK_PRIOR
VK_NEXT
VK_END
VK_HOME
VK_LEFT
VK_UP
VK_RIGHT
VK_DOWN
VK_SELECT
VK_PRINT
VK_EXECUTE
VK_SNAPSHOT
VK_INSERT
VK_DELETE
VK_HELP

VK_NUMPAD0
VK_NUMPAD1
VK_NUMPAD2
VK_NUMPAD3
VK_NUMPAD4
VK_NUMPAD5
VK_NUMPAD6
VK_NUMPAD7
VK_NUMPAD8
VK_NUMPAD9
VK_MULTIPLY
VK_ADD
VK_SEPARATOR
VK_SUBTRACT
VK_DECIMAL
VK_DIVIDE
VK_F1
VK_F2
VK_F3
VK_F4
VK_F5
VK_F6
VK_F7
VK_F8
VK_F9
VK_F10
VK_F11
VK_F12
VK_F13
VK_F14
VK_F15
VK_F16
VK_F17
VK_F18
VK_F19
VK_F20
VK_F21
VK_F22
VK_F23
VK_F24
VK_NUMLOCK
VK_SCROLL


Visual Basic Constants for Key Codes

Do the following to find the Visual Basic key codes:

1. | On the View pull-down menu, select Object Browser....
2. | Select VB - Visual Basic objects and procedures.
3. | Select VBKeyCodeConstants.
4. | Select one of the listed constants.

A description of the constant appears at the bottom of the form.


Topic Selection

LEAD Technologies, Inc.
1201 Greenwood Cliff, Suite 400
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.


lFlags Parameter For Acquire

lFlags

Flag that determines certain actions of the TWAIN source. Possible values are:

Value | Meaning
L_LTWAIN_SHOW_USER_INTERFACE | [0x0001] Shows the manufacturer's user interface as modeless.
L_LTWAIN_MODAL_USER_INTERFACE | [0x0002] Shows the manufacturer's user interface as a modal dialog. Works only if the L_LTWAIN_SHOW_USER_INTERFACE flag is set.
L_LTWAIN_KEEPOPEN | [0x0020] Keep the TWAIN data source open after scanning.


bMulti Parameter For AcquireMulti

bMulti

Flag that indicates whether to save images to a multi-page file or to separate files. Possible values are:

Value | Meaning
TRUE | The scanned images will be saved in one file with multiple pages, if the format supports multi-page files.
FALSE | Each scanned image will be saved in a separate file.

Notice that if the format doesn't support multi-page files, then each scanned page will be saved in a separate file.


bstrBaseFileName Parameter For AcquireMulti

bstrBaseFileName

Character string containing the base name of the image file(s) in which to save the acquired data.


bFinishScan Parameter for AcquireMultiEvent

bFinishScan

Flag that indicates the status of the scanning process. Possible values are:

Value | Meaning
TRUE | Scanning of the page has finished.
FALSE | Scanning of the page has just started.


bstrFileName Parameter for AcquireMultiEvent

bstrFileName

Character string containing the name of the file in which to save the scanned image(s).


nPage Parameter for AcquireMultiEvent

nPage

Number of the page being scanned.


lFlags Parameter For AcquireMulti

lFlags

Flag that determines certain actions of the TWAIN source. Possible values are:

Value | Meaning
L_LTWAIN_SHOW_USER_INTERFACE | [0x0001] Shows the manufacturer's user interface as modeless.
L_LTWAIN_MODAL_USER_INTERFACE | [0x0002] Shows the manufacturer's user interface as a modal dialog. Works only if the L_LTWAIN_SHOW_USER_INTERFACE flag is set.
L_LTWAIN_KEEPOPEN | [0x0020] Keep the TWAIN data source open after scanning.


Return for AcquireMulti

Return Value

Return | Meaning
0 | The function was successful.
<>0 | An error occurred. Refer to Error Codes.


pBitmap Parameter for AcquirePageEvent

pBitmap

Pointer to a bitmap acquired from the Twain Source.


Return for Acquire

Return Value

Return | Meaning
0 | The function was successful.
<>0 | An error occurred. Refer to Error Codes.


nIndex Parameter For ArrayCapValue

nIndex

Index into the array of values.

This value must be between 0 and the value of the ArrayNumOfItems property.


nIndex Parameter For Capability

nIndex

Index into the array of capabilities.


Return for EndSession

Return Value

Return | Meaning
0 | The function was successful.
<>0 | An error occurred. Refer to Error Codes.


nIndex Parameter For EnumCapValue

nIndex

Index into the array of values.

This value must be between 0 and the value of the EnumNumOfItems property.


nIndex Parameter For EnumCapValue

nIndex

Index into the array of values.

This value must be between 0 and the value of the EnumNumOfItems property property.


nIndex parameter for FamilyName

nIndex

Index of the source for which to get the family name. This value must be between 0 and the value of the SourceCount property.


pltResConfig parameter for FastConfigEvent

pltResConfig

Pointer to an ILTFastConfig interface referencing the information for the scan configuration being tested.


iIndex parameter for FastConfigsResult

iIndex

Index into the array of scan configurations.

This is a zero-based index.


bstrWorkingFolder parameter for FindFastConfig

bstrWorkingFolder

Character string containing the path to the working folder in which to save the tested images.


iBitsPerPixel parameter for FindFastConfig

iBitsPerPixel

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 iBitsPerPixel is 0, the file will be stored using the closest BitsPerPixel value supported by that format.


iBufferIteration parameter for FindFastConfig

iBufferIteration

Number of memory configurations that will be tested. The maximum value for this parameter is 10.


lFlags parameter for FindFastConfig

lFlags

Flags that control the display of the user interface and the actions of the method. Possible values are:

Value | Meaning
L_LTWAIN_SHOW_USER_INTERFACE | [0x0001] Shows the manufacturer's user interface as modeless.
L_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.
L_LTWAIN_USE_THREAD_MODE | [0x0008] Use the fast Thread mode.
L_LTWAIN_CHECK_ALL_DEFAULT_BPP | [0x0010] Tests all supported BPP.
L_LTWAIN_KEEPOPEN | [0x0020] Keep the TWAIN data source open after scanning.


Return for FindFastConfig

Return Value

Return | Meaning
0 | The function was successful.
<>0 | An error occurred. Refer to Error Codes.


lFlags Parameter For GetCapability2

lFlags

Flags that indicate the capability values to get. Possible values are:

Value | Meaning
L_LTWAIN_CAPABILITY_GETCURRENT | Get the current value.
L_LTWAIN_CAPABILITY_GETDEFAULT | Get the default value.
L_LTWAIN_CAPABILITY_GETVALUES | Get all available values.


pltTwCap Parameter For GetCapability2

pltTwCap

Pointer to an ILEADTwainCapability structure that references the capability values to get.


Return for GetCapability2

Return Value

Return | Meaning
0 | The function was successful.
<>0 | An error occurred. Refer to Error Codes.


lFlags Parameter For GetCapability

lFlags

Flags that indicate the capability values to get. Possible values are:

Value | Meaning
L_LTWAIN_CAPABILITY_GETCURRENT | Get the current value.
L_LTWAIN_CAPABILITY_GETDEFAULT | Get the default value.
L_LTWAIN_CAPABILITY_GETVALUES | Get all available values.


pCapability Parameter For GetCapability

pCapability

Pointer to an ICapability structure that references the capability values to get.


Return for GetCapability

Return Value

Return | Meaning
0 | The function was successful.
<>0 | An error occurred. Refer to Error Codes.


pExtImageInfo Parameter For GetExtImageInfo

pExtImageInfo

Pointer to an ItwExtImageInfo interface to be updated with the extended image information.


Return for GetExtImageInfo

Return Value

Return | Meaning
0 | The function was successful.
<>0 | An error occurred. Refer to Error Codes.


iFlags parameter for GetJPEGCompression

iFlags

Flags that indicate the JPEG compression values to get. Possible values are:

Value | Meaning
L_LTWAIN_GET_JPEG_COMPRESSION | [0x0001] Get the current JPEG compression settings.
L_LTWAIN_GET_DEFAULT_JPEG_COMPRESSION | [0x0002] Get the default JPEG compression settings.


Return for GetJPEGCompression

Return Value

Return | Meaning
0 | The method was successful.
<>0 | An error occurred. Refer to Error Codes.


Return for GetProperties

Return Value

Return | Meaning
0 | The function was successful.
<>0 | An error occurred. Refer to Error Codes.


iBitsPerPixel parameter for GetScanConfigs

iBitsPerPixel

Number of bits per pixel for which to get the default scan configurations.


iBufferIteration parameter for GetScanConfigs

iBufferIteration

Number of memory configurations that will be tested. This method uses this number to determine which default scan configurations to get. This value is only used if iTransferMode is L_LTWAIN_BUFFER_MODE.


iTransferMode parameter for GetScanConfigs

iTransferMode

Transfer mode for which to get the default scan configurations. Possible values are:

Value | Meaning
L_LTWAIN_FILE_MODE | [0x001] Use File transfer mode.
L_LTWAIN_BUFFER_MODE | [0x002] Use Memory transfer mode.
L_LTWAIN_NATIVE_MODE | [0x004] Use Native transfer mode.


Return for GetScanConfigs

Return Value

Return | Meaning
0 | The function was successful.
<>0 | An error occurred. Refer to Error Codes.


Return for GetTransferOptions

Return Value

Return | Meaning
0 | The method was successful.
<>0 | An error occurred. Refer to Error Codes.


iIndex parameter for HuffmanAC

iIndex

Value that specifies the index for the table. This is a zero based value.


iIndex parameter for HuffmanDC

iIndex

Value that specifies the index for the table, this is a zero based value.


iIndex parameter for HuffmanMap

iIndex

Value that specifies the index for the table. This is a zero based value.


Return for InitSession

Return Value

Return | Meaning
0 | The function was successful.
<>0 | An error occurred. Refer to Error Codes.


hWnd Parameter For InitSession

hWnd

Handle of the parent window. This may not be 0 or NULL.


Return for IsSupportLocked

Return Value

Return | Meaning
TRUE | The optional feature is locked.
FALSE | The optional feature is available in your toolkit.


iType Parameter For IsSupportLocked

iType

The optional feature to check.

Value | Meaning
L_SUPPORT_BARCODES_1D | Support for reading and writing Linear bar codes. This is available in the LEADTOOLS 1D Module.
L_SUPPORT_BARCODES_1D_SILVER | Support for reading and writing Linear bar codes silver module. This is available in the LEADTOOLS 1D Silver Module.
L_SUPPORT_BARCODES_PDF_READ | Support for reading PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (read).
L_SUPPORT_BARCODES_PDF_WRITE | Support for writing PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (write).
L_SUPPORT_BARCODES_DATAMATRIX_READ | Support for reading Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (read).
L_SUPPORT_BARCODES_DATAMATRIX_WRITE | Support for writing Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (write).
L_SUPPORT_BARCODES_QR_READ | Support for reading QR bar codes. This is available in the LEADTOOLS 2D QR Module (read).
L_SUPPORT_BARCODES_QR_WRITE | Support for writing QR bar codes. This is available in the LEADTOOLS 2D QR Module (write).
L_SUPPORT_BITONAL | Support for Scale to Gray and Favor Black processing.
L_SUPPORT_CMW | Support for the CMW file format, which uses Wavelet CMP compression.
L_SUPPORT_DICOM | DICOM file format support, but not the DICOM Communication support.
L_SUPPORT_DOCUMENT | LEADTOOLS Document features . A LEADTOOLS Document license is required
L_SUPPORT_EXTGRAY | Support for 12 bit grayscale, 16-bit grayscale, 48-bit color and 64-bit color image creation and manipulation.
L_SUPPORT_ICR | Support for the ICR Module within the OCR engine. This supports the recognition of handwritten text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_J2K | Unlocks support for JPEG2000 images. The support needs to be unlocked to read and write both types of JPEG 2000 images (JPEG 2000 stream and JP2 files).
L_SUPPORT_LTPRO | Support for advanced image processing functions only available in the Raster Pro and above toolkits.
L_SUPPORT_MEDICAL | Support for the capabilities unlocked by L_SUPPORT_DICOM and L_SUPPORT_EXTGRAY, plus all Medical features.
L_SUPPORT_MEDICAL_NET | Support for everything unlocked by L_SUPPORT_MEDICAL, plus support for the unsecure DICOM Network Communication for Message Exchange.
L_SUPPORT_OCR | Support for the OCR features. (Document/Medical).
L_SUPPORT_OCR_ASIAN | Support for the OCR engine to recognize Asian text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_OCR_PDF_OUTPUT | Support for saving OCR results as a PDF file. This license is in addition to the cost of the OCR Plugin or Document Imaging Suite.
L_SUPPORT_OMR | Support for the OMR Module within the OCR engine. This supports the recognition of check boxes. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_PDF | Support for the PDF, PS and EPS file formats. Available only in the LEADTOOLS PDF Plug in. If this support is locked, the PDF, PS and EPS files will not be loaded or saved.
L_SUPPORT_PDF_SAVE | Support for saving raster images as a PDF file. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_VECTOR | Support for the Vector Features and Vector file formats. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selection.


Return for IsAvailable

Return Value

Return | Meaning
TRUE | A TWAIN source is installed.
FALSE | No TWAIN sources are installed.


hWnd Parameter For IsAvailable

hWnd

Handle to a window.


nIndex Parameter For Item

nIndex

Index into the array of extended image information.


nParam1 Parameter For Item

nParam1

Additional parameter that contains extended image information.

For example when getting barcode text, the barcode text length will be passed in this parameter.


pCapability Parameter For LoadTemplateEvent2

pCapability

Pointer to an ILEADTwainCapability interface to be updated with the capability value loaded from a template file.


pCapability Parameter For LoadTemplateEvent

pCapability

Pointer to an ICapability interface to be updated with the capability value loaded from a template file.


Return for LoadTemplate

Return Value

Return | Meaning
0 | The function was successful.
<>0 | An error occurred. Refer to Error Codes.


strTemplateFile Parameter For LoadTemplate

strTemplateFile

String that contains the name of the template file from which to load the TWAIN capabilities.


nIndex Parameter For ManufacturerName

nIndex

Index of the source for which to get the manufacturer's name. This value must be between 0 and the value of the SourceCount property.


nIndex Parameter For PtwInfo

nIndex

Index of the extended image information to get. Possible values can be between 0 and the value of NumOfInfos – 1.


iIndex parameter for QuantMap

iIndex

Value that specifies the index for the table. This is a zero based index.


iIndex parameter for QuantTable

iIndex

Value that specifies the index for the table. This is a zero based value.


pCapability Parameter For QueryCapability

pCapability

Pointer to an ICapability structure that contains the capability to set.


Return for QueryCapability

Return Value

Return | Meaning
0 | The function was successful.
<>0 | An error occurred. Refer to Error Codes.


FileMsg parameter for QueryFileSystem

FileMsg

Files system messages that determine the behavior of the method. For possible values, refer to FILESYSTEM_MSG.


Return for QueryFileSystem

Return Value

Return | Meaning
0 | The method was successful.
<>0 | An error occurred. Refer to Error Codes.


iIndex parameter for RGBElements

iIndex

Index of the RGB element in the elements array. This is a zero-based index.


pCapability Parameter For SaveTemplateEvent2

pCapability

Pointer to an ILEADTwainCapability interface that references the capability values to be saved.


pCapability Parameter For SaveTemplateEvent

pCapability

Pointer to an ICapability interface that references the capability values to be saved.


Return for SaveTemplate

Return Value

Return | Meaning
0 | The function was successful.
<>0 | An error occurred. Refer to Error Codes.


strTemplateFile Parameter For SaveTemplate

strTemplateFile

String that contains the name of the file in which to save the capabilities of the selected TWAIN source.


iIndex parameter for ScanConfig

iIndex

Index into the array of scan configurations.

This is a zero-based index.


Return for SelectSource

Return Value

Return | Meaning
0 | The function was successful.
<>0 | An error occurred. Refer to Error Codes.


IFlags Parameter For SetCapability2

lFlags

Flags that indicate whether to set or reset the capability value. Possible values are:

Value | Meaning
L_LTWAIN_CAPABILITY_SET | Set the capability to the value specified in the pltTwCap.
L_LTWAIN_CAPABILITY_RESET | Reset the value of the capability to the default value defined by the TWAIN source.


pltTwCap Parameter For SetCapability2

pltTwCap

Pointer to an ILEADTwainCapability structure that contains the capability to set.


Return for SetCapability2

Return Value

Return | Meaning
0 | The function was successful.
<>0 | An error occurred. Refer to Error Codes.


IFlags Parameter For SetCapability

lFlags

Flags that indicate whether to set or reset the capability value. Possible values are:

Value | Meaning
L_LTWAIN_CAPABILITY_SET | Set the capability to the value specified in the pCapability.
L_LTWAIN_CAPABILITY_RESET | Reset the value of the capability to the default value defined by the TWAIN source.


pCapability Parameter For SetCapability

pCapability

Pointer to an ICapability interface that references the capability values to get. This will be updated with the available values for the specified capability.


Return for SetCapability

Return Value

Return | Meaning
0 | The function was successful.
<>0 | An error occurred. Refer to Error Codes.


iFlags parameter for SetJPEGCompression

iFlags

Flags that indicate the JPEG compression values to set. Possible values are:

Value | Meaning
L_LTWAIN_SET_JPEG_COMPRESSION | [0x0001] Set new JPEG compression options
L_LTWAIN_RESET_JPEG_COMPRESSION | [0x0002] Restore default JPEG compression options


Return for SetJPEGCompression

Return Value

Return | Meaning
0 | The method was successful.
<>0 | An error occurred. Refer to Error Codes.


Return for SetProperties

Return Value

Return | Meaning
0 | The function was successful.
<>0 | An error occurred. Refer to Error Codes.


iFlag parameter for SetRGBResponse

iFlag

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.


nBitsPerPixel parameter for SetRGBResponse

nBitsPerPixel

Bits per pixel to be set. This is used to determine the number of RGB elements.


Return for SetRGBResponse

Return Value

Return | Meaning
0 | The method was successful.
<>0 | An error occurred. Refer to Error Codes.


Return for SetTransferOptions

Return Value

Return | Meaning
0 | The method was successful.
<>0 | An error occurred. Refer to Error Codes.


bShow parameter for ShowProgress

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 the progress indicator during image acquisition.
FALSE | Hides the progress indicator during image acquisition.


Return for ShowProgress

Return Value

Return | Meaning
0 | The method was successful.
<>0 | An error occurred. Refer to Error Codes.


Return for ShowTemplateDlg

Return Value

Return | Meaning
0 | The function was successful.
<>0 | An error occurred. Refer to Error Codes.


strTemplateFile Parameter For ShowTemplateDlg

strTemplateFile

String that contains the name of the file in which to save the capabilities of the selected source, if the OK (or SCAN) button is pressed.


nIndex Parameter For SourceName

nIndex

Index of the source name to get. This value must be between 0 and the value of the SourceCount property.


iType Parameter For UnlockSupport

iType

The optional feature to unlock.

Value | Meaning
L_SUPPORT_BARCODES_1D | Support for reading and writing Linear bar codes. This is available in the LEADTOOLS 1D Module.
L_SUPPORT_BARCODES_PDF_READ | Support for reading PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (read).
L_SUPPORT_BARCODES_PDF_WRITE | Support for writing PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (write).
L_SUPPORT_BARCODES_DATAMATRIX_READ | Support for reading Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (read).
L_SUPPORT_BARCODES_DATAMATRIX_WRITE | Support for writing Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (write).
L_SUPPORT_BITONAL | Support for Scale to Gray and Favor Black processing.
L_SUPPORT_CMW | Support for the CMW file format, which uses Wavelet CMP compression.
L_SUPPORT_DICOM | DICOM file format support, but not the DICOM Communication support.
L_SUPPORT_DOCUMENT | LEADTOOLS Document features . A LEADTOOLS Document license is required
L_SUPPORT_EXTGRAY | Support for 12 bit grayscale, 16-bit grayscale, 48-bit color and 64-bit color image creation and manipulation.
L_SUPPORT_ICR | Support for the ICR Module within the OCR engine. This supports the recognition of handwritten text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_J2K | Unlocks support for JPEG2000 images. The support needs to be unlocked to read and write both types of JPEG 2000 images (JPEG 2000 stream and JP2 files).
L_SUPPORT_LTPRO | Support for advanced image processing functions only available in the Raster Pro and above toolkits.
L_SUPPORT_MEDICAL | Support for the capabilities unlocked by L_SUPPORT_DICOM and L_SUPPORT_EXTGRAY, plus all Medical features.
L_SUPPORT_MEDICAL_NET | Support for everything unlocked by L_SUPPORT_MEDICAL, plus support for the unsecure DICOM Network Communication for Message Exchange.
L_SUPPORT_OCR | Support for the OCR features. (Document/Medical).
L_SUPPORT_OCR_ASIAN | Support for the OCR engine to recognize Asian text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_OCR_PDF_OUTPUT | Support for saving OCR results as a PDF file. This license is in addition to the cost of the OCR Plugin or Document Imaging Suite.
L_SUPPORT_OMR | Support for the OMR Module within the OCR engine. This supports the recognition of check boxes. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_PDF | Support for the PDF, PS and EPS file formats. Available only in the LEADTOOLS PDF Plug in. If this support is locked, the PDF, PS and EPS files will not be loaded or saved.
L_SUPPORT_PDF_SAVE | Support for saving raster images as a PDF file. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_VECTOR | Support for the Vector Features and Vector file formats. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selection.


pszKey Parameter For UnlockSupport

pszKey

The key to unlock the feature.


iIndex parameter for UserFastConfigs

iIndex

Index into the array of scan configurations.

This is a zero-based index.