Displays the TWAIN source manufacturer's template dialog, without actually acquiring an image.
#include "lttwn.h"
L_LTTWN_API L_INT L_TwainTemplateDlg (hSession, lpszTemplateFile, pfnCallBack, pfnErCallBack, pUserData)
Handle to an existing TWAIN session. This handle is obtained by calling the L_TwainInitSession or L_TwainInitSession2 function.
A character string that contains the name of the template file used in the saving the capability values.
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.
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.
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.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
! = SUCCESS | An error occurred. Refer to Return Codes. |
This function saves the current values of all the supported capabilities to the specified file.
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;
}