#include "lttwn.h"

L_LTTWN_API L_INT L_TwainSelectSource (hSession, pltSource)

Displays the TWAIN dialog box to be used to select a TWAIN source for acquiring images.



Handle to an existing TWAIN session. This handle is obtained by calling the L_TwainInitSession or L_TwainInitSession2 function.


Pointer to a structure containing the name of the TWAIN source to select.


Value Meaning
SUCCESS The function was successful.
! = SUCCESS An error occurred. Refer to Return Codes.


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:

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

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