L_TwainSelectSource (original) (raw)
Summary
Displays the TWAIN dialog box to be used to select a TWAIN source for acquiring images.
Syntax
#include "lttwn.h"
L_LTTWN_API L_INT L_TwainSelectSource (hSession, pltSource)
Parameters
HTWAINSESSION hSession
Handle to an existing TWAIN session. This handle is obtained by calling the L_TwainInitSession or L_TwainInitSession2 function.
pLTWAINSOURCE pltSource
Pointer to a structure containing the name of the TWAIN source to select.
Returns
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
! = SUCCESS | An error occurred. Refer to Return Codes. |
Comments
LEADTOOLS TWAIN toolkits support both the TWAIN 1.9 and the TWAIN 2.x specifications.
After establishing the TWAIN session handle by calling either L_TwainInitSession or L_TwainInitSession2, select the TWAIN source for acquiring images by calling L_TwainSelectSource. For more information, refer to Managing the TWAIN Source.
Pass NULL for the pltSource parameter to display the default TWAIN Select Source dialog provided by the TWAIN Working Group.
To select a device programmatically, set LTWAINSOURCE.pszTwainSourceName equal to the name of the desired device and then pass the address of the LTWAINSOURCE structure for the pltSource parameter.
The default behavior for L_TwainSelectSource is to determine whether the TWAIN 2.x DLL is loaded on the system. If it is, the toolkit tries to load it. If loading TWAIN 2.x fails or if the scanner is not compatible with TWAIN 2.x, the LEADTOOLS TWAIN toolkit will try to start TWAIN 1.9.
Call L_TwainSetVersion to override the default behavior of L_TwainSelectSource, as follows:
- Pass "TWAIN_VERSION1" to L_TwainSetVersion to force the toolkit to use TWAIN version 1.9 for the rest of the session.
- Likewise, pass "TWAIN_VERSION2" to force the toolkit to use TWAIN version 2.x for the rest of the session.
- If L_TwainSelectSource is called after L_TwainSetVersion has been called, the toolkit will change the source to the one selected, but will continue to use the TWAIN version set by L_TwainSetVersion. For more information, refer to Setting which TWAIN Specification Version to use.
Call L_TwainGetVersion to determine which TWAIN specification is currently being used by the LEADTOOLS TWAIN toolkit.
Call L_TwainGetSources to get information available for either all TWAIN sources (or the currently selected TWAIN source) installed on the system.
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
- L_TwainGetSources
- L_TwainInitSession
- L_TwainInitSession2
- L_TwainEndSession
- L_TwainGetVersion
- L_TwainSetVersion
Topics
- Managing the TWAIN Source
- TWAIN Functionality: Property Functions
- Setting which TWAIN Specification Version to use
- Using the LEADTOOLS THUNK Utility with TWAIN
- Programming with the LEADTOOLS TWAIN Functions
Example
For an example, refer to L_TwainAcquire.