L_LTTWN_API L_INT L_TwainFindFastConfig(hSession, pszWorkingFolder, uFlags, nBitsPerPixel, nBufferIteration, pInFastConfigs, nInFastConfigsCount, ppTestConfigs, pnTestConfigsCount, pOutBestConfig, uStructSize, pfnCallBack, pUserData)
Determines the best scanner configuration.
Character string containing the path to the working folder in which to save the tested images.
Flags that control the display of the user interface and the actions of the function. Possible values are:
|LTWAIN_SHOW_USER_INTERFACE||[0x0001] Show the manufacturer's user interface as modeless.|
|LTWAIN_MODAL_USER_INTERFACE||[0x0002] Show the manufacturer's user interface as a modal dialog. Works only if the LTWAIN_SHOW_USER_INTERFACE flag is set.|
|LTWAIN_USE_THREAD_MODE||[0x0008] Use the fast Thread mode.|
|LTWAIN_CHECK_ALL_DEFAULT_BPP||[0x0010] Test all supported BPP.|
|LTWAIN_KEEPOPEN||[0x0020] Keep the TWAIN data source open after scanning.|
|LTWAIN_SUPPRESS_MESSAGE_BOXES||[0x0100] Suppress message boxes that appear before the manufacturer's user interface dialog.|
Resulting file's pixel depth. Note that not all bits per pixel are available to all file formats. For valid values, refer to Formats of Output Files. If nBitsPerPixel is 0, the file will be stored using the closest BitsPerPixel value supported by that format.
This value is used to determine the number of memory configurations that will be tested. The maximum value for this parameter is 10.
Pointer to a FASTCONFIG structure that contains an array of scan configurations to be tested. Pass NULL to test the default scan configurations.
Number of scan configurations referenced in pInFastConfigs. Pass 0 to test the default scan configurations.
Address of a pointer to a FASTCONFIG structure. The function will automatically allocate an array of FASTCONFIG structures using the total number of test configurations.
Pointer to an integer variable to be updated with the number of tested configurations.
Pointer to a FASTCONFIG structure to be updated with the best configuration for the scanner.
Size in bytes, of the structures pointed to by pInFastConfigs, ppTestConfigs, and pOutBestConfig, for versioning. Use sizeof(FASTCONFIG).
Optional callback function, called for each scan configuration as it is tested.
The callback function must adhere to the function prototype described in the LTWAINFINDFASTCONFIG function.
Void pointer that you can use to pass one or more additional parameters that the callback function needs.
To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to
L_VOID *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure.
If the additional parameters are not needed, you can pass NULL in this parameter.
|SUCCESS||The function was successful.|
|! = SUCCESS||An error occurred. Refer to Return Codes.|
This function will test scan configurations for the scanner selected by calling L_TwainSelectSource. It will update the pOutBestConfig parameter with the best scan configuration tested. After the best scan configuration has been determined, the scan configuration's values for the transfer mode, bits per pixel, format and buffer size can be passed to L_TwainAcquireMulti so the images can be scanned as quickly as possible.
To test user-defined/custom configurations, pass these configurations in pInFastConfigs and the number of configurations in nInFastConfigsCount.
To test the default configurations available for the TWAIN driver, pass NULL for pInFastConfigs and 0 for nInFastConfigsCount. In this case, the function will test scan configurations based the values passed in the nBitsPerPixel and nBufferIteration parameters.
The list of default scan configurations to test can be shortened by using the L_TwainGetScanConfigs function to get a list of default scan configurations based on transfer mode, bits per pixel and number of buffers. This list can then be passed to L_TwainFindFastConfig function to determine the best and fastest scan configuration.
If LTWAIN_CHECK_ALL_DEFAULT_BPP is set in uFlags, then the function will test all supported bits per pixel for the selected scanner. If this flag is not set in uFlags, then the function will use the iBitsPerPixel parameter value.
If LTWAIN_USE_THREAD_MODE is set in uFlags, then the image acquisition process will run in thread mode. In some scanners, acquiring images in thread mode will improve the speed at which the image(s) is(are) acquired. In other scanners, (high-speed scanners, for example), acquiring the image(s) in thread mode will provide little to no improvement in the speed at which the image(s) is(are) acquired.
The nBitsPerPixel parameter and LTWAIN_CHECK_ALL_DEFAULT_BPP flag will be used only if the transfer mode for the scan configuration being tested is LTWAIN_BUFFER_MODE or LTWAIN_NATIVE_MODE.
The nBufferIteration parameter will be used only if the transfer mode for the scan configuration being tested is LTWAIN_BUFFER_MODE.
If a valid callback function is passed for pfnCallBack, the scan configuration testing process can be stopped by returning any value other than SUCCESS for the callback function. The testing process is continued by returning SUCCESS for the callback function.
This function allocates storage for the array of scan configurations in ppTestConfigs. When this storage is no longer needed, you must free the storage by calling L_TwainFreeScanConfig.
The LTWAIN_KEEPOPEN flag works only in the following cases:
Passed with LTWAIN_SHOW_USER_INTERFACE flag to make the TWAIN user-interface appears as a modeless dialog. The TWAIN data source remains open after scanning until the user closes it.
Passed with LTWAIN_SHOW_USER_INTERFACE and LTWAIN_MODAL_USER_INTERFACE flags to make the TWAIN user-interface appears as a modal dialog. The TWAIN data source remains open after scanning until the user closes it.
This function shows some helper message boxes while its running guiding the user through the running tests, if you wish to suppress these message then pass LTWAIN_SUPPRESS_MESSAGE_BOXES flag and these messages will stop showing up.
Required DLLs and Libraries
For an example, refer to L_TwainFindFastConfig.