L_TwainTemplateDlg

Summary

Displays the TWAIN source manufacturer's template dialog, without actually acquiring an image.

Syntax

#include "lttwn.h"

L_LTTWN_API L_INT L_TwainTemplateDlg (hSession, lpszTemplateFile, pfnCallBack, pfnErCallBack, pUserData)

Parameters

HTWAINSESSION hSession

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

L_TCHAR * lpszTemplateFile

A character string that contains the name of the template file used in the saving the capability values.

LTWAINSAVECAPCALLBACK pfnCallBack

Optional callback function, used to access the capability information before saving.

If you do not provide a callback function, use NULL as the value of this parameter. If you do provide a callback function, use the function pointer as the value of this parameter. The callback function must adhere to the function prototype described in LTWAINSAVECAPCALLBACK function.

LTWAINSAVEERRORCALLBACK pfnErCallBack

Optional callback function, called as each property is set. It lets the user know if an error occurred.

If you do not provide a callback function, use NULL as the value of this parameter. No error reporting will occur. If you do provide a callback function, use the function pointer as the value of this parameter. The callback function must adhere to the function prototype described in LTWAINSAVEERRORCALLBACK function.

L_VOID * pUserData

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.

Returns

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

Comments

This function saves the current values of all the supported capabilities to the specified file.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT EXT_CALLBACK BeforeSaveCB(HTWAINSESSION  hSession, 
                                pTW_CAPABILITY ptwCap, 
                                L_VOID       * pData) 
{ 
   UNREFERENCED_PARAMETER(hSession); 
   UNREFERENCED_PARAMETER(ptwCap); 
   UNREFERENCED_PARAMETER(pData); 
 
   // Do pre operations on data to save 
   return SUCCESS; 
} 
 
L_INT EXT_CALLBACK SaveErrorCB(HTWAINSESSION  hSession, 
                               pTW_CAPABILITY ptwCap, 
                               L_UINT         uError, 
                               L_VOID       * pData) 
{ 
   UNREFERENCED_PARAMETER(hSession); 
   UNREFERENCED_PARAMETER(ptwCap); 
   UNREFERENCED_PARAMETER(uError); 
   UNREFERENCED_PARAMETER(pData); 
 
   // Do the error handling 
   return SUCCESS; 
} 
 
L_INT TwainTemplateDlgExample(L_TCHAR* pszFileName,HTWAINSESSION g_hSession) 
{ 
   L_INT nRet = L_TwainTemplateDlg (g_hSession, pszFileName, BeforeSaveCB, SaveErrorCB, NULL); 
   return nRet; 
} 
Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS TWAIN C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.