L_TwainInitSession

Summary

Initializes the TWAIN session.

Syntax

#include "lttwn.h"

L_LTTWN_API L_INT L_TwainInitSession (phSession, pAppData)

Parameters

pHTWAINSESSION phSession

Pointer to a TWAIN session handle. This handle is needed to acquire pages from the TWAIN source, and work with template files, containers, capabilities, and properties.

pAPPLICATIONDATA pAppData

Pointer to an APPLICATIONDATA structure. This structure will contain the handle of the parent window in addition to other data about the application.

Returns

Value Meaning
SUCCESS The function was successful.
! = SUCCESS An error occurred. Refer to Return Codes.
ERROR_TWAIN_INVALID_DLL (-561) Invalid DLL. Most likely, this is because an old version of TWAINDSM.DLL is in the system folder. Make sure you have at least version 2.0.9.0 of this DLL. Download the DLL from www.twain.org.

Comments

L_TwainInitSession (or L_TwainInitSession2) must be called before calling any other LEADTOOLS TWAIN toolkit functions.

When the handle to the TWAIN session is no longer needed, free it by calling L_TwainEndSession. Every call to L_TwainInitSession or L_TwainInitSession2 requires a call to L_TwainEndSession.

TWAIN Specification Support

LEADTOOLS TWAIN toolkits support both the TWAIN 1.9 and the TWAIN 2.x specifications. By default LEADTOOLS TWAIN will try to load the TWAIN 2.x DLL if it exists in the system. If that fails or if the scanner is not compatible with TWAIN 2.x, it will try to start TWAIN 1.9.

You can also override the default behavior and explicitly set which version of TWAIN the selected device will use. To do so, call L_TwainSetVersion and pass "TWAIN_VERSION1" to use version 1.9, or "TWAIN_VERSION2" to use version 2.x. Calling L_TwainSetVersion changes the way L_TwainSelectSource behaves for the rest of the session. For more information, refer to Setting which TWAIN Specification Version to use and Managing the TWAIN Source.

Call L_TwainGetVersion to determine which TWAIN specification is currently being used by the LEADTOOLS TWAIN toolkit.            

Required DLLs and Libraries

See Also

Functions

Topics

Example

For an example, refer to L_IsTwainAvailable.

Help Version 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS TWAIN C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.