#include "ltwrappr.h"
virtual L_INT LTwain::InitSession (pAppData)
L_INT LTwain::InitSession (pAppData, uFlags)
Initializes the TWAIN session.
Pointer to an APPLICATIONDATA structure. This structure will have the handle of the parent window in addition to other data about the application.
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. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
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.
- For more details about the process flow summarizing the default behavior, refer to Startup2 Method: Default Behavior.
- For further details of the process flow summarizing the function's behavior when passing specific flags, refer to Startup2 Method: Using the Thunk Server.
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.
For an example, refer to LTwain::IsAvailable.