#include "ltwrappr.h"
virtual L_INT LTwain::InitSession (pAppData)
L_INT LTwain::InitSession (pAppData, uFlags)
pAPPLICATIONDATA pAppData; | pointer to a structure |
L_UINT uFlags; | flags |
Initializes the TWAIN session.
Parameter | Description | |
pAppData | Pointer to an APPLICATIONDATA structure. This structure will have the handle of the parent window in addition to other data about the application. | |
uFlags | Flags that indicate the function behavior. Possible values are: | |
Value | Meaning | |
LTWAIN_INIT_MULTI_THREADED | [0x0001] Initializes the TWAIN session with the multi-threaded option. | |
LTWAIN_INIT_USE_THUNKSERVER | [0x0002] Initializes the TWAIN session with the THUNK server option. | |
0 | Behaves the same way LTwain::InitSession(pAppData) does. |
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, it should be freed by calling LTwain::EndSession. For every call to LTwain::InitSession there must be a call to LTwain::EndSession.
When passing LTWAIN_INIT_USE_THUNKSERVER to uFlags, it detects and interacts with a 32-bit TWAIN driver or device from a 64-bit process application.
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 distributables for the application all dependency files listed in the Using the LEADTOOLS THUNK Utility with TWAIN.
Note: If this function returned ERROR_TWAIN_INVALID_DLL error, then this is mostly because you have an old version of TWAINDSM.DLL in your system folder, you need to make sure you have at least version 2.0.9.0 of this DLL. You can download it from www.twain.org.
Required DLLs and Libraries
LTTWN
For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.
Functions: | LTwain::EndSession, Class Members |
Topics: | Initializing a TWAIN Session |
Using LEADTOOLS THUNK Utility with TWAIN | |
TWAIN Functionality: Session Functions. |
For an example, refer to LTwain::IsAvailable.