LTwain::InitSession

Summary

Initializes the TWAIN session.

Syntax

#include "ltwrappr.h"

virtual L_INT LTwain::InitSession (pAppData)

L_INT LTwain::InitSession (pAppData, uFlags)

Parameters

pAPPLICATIONDATA pAppData

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

L_UINT uFlags

Flags that indicate the function behavior. Possible values are:

Value Meaning
LTWAIN_INIT_MULTI_THREADED [0x0001] Initialize the TWAIN session with the multi-threaded option.
LTWAIN_INIT_USE_THUNKSERVER [0x0002] Initialize the TWAIN session with the THUNK server option.
0 Behave the same way LTwain::InitSession(pAppData) does.

Returns

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

Comments

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

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

Pass LTWAIN_INIT_USE_THUNKSERVER to uFlags when detection and interaction with a 32-bit TWAIN driver or device from a 64-bit process application is required.

Pass this value only when using a TWAIN device that does not have a 64-bit driver and the operating system is 64-bit. When using the THUNK server be sure to include in the redistributables for the application all dependency files listed in the Using the LEADTOOLS THUNK Utility with TWAIN topic.

Note: If this function returns ERROR_TWAIN_INVALID_DLL error, then this is mostly likely because of an old version of TWAINDSM.DLL in the system folder. Make sure the DLL is at least version 2.0.9.0. Download it from www.twain.org.

Note: When using the thunk server, working on a 64-Bit operating system, and using a TWAIN device without a 64-Bit driver, it is best to pass NULL to hWnd in pAppData parameter.

TWAIN Session Behavior

A TWAIN session is a communication session between LEADTOOLS Twain and your TWAIN sources. The internal TWAIN session handle provides access to this TWAIN session.

Required DLLs and Libraries

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

See Also

Functions

Topics

Example

For an example, refer to LTwain::IsAvailable.

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

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