L_TwainTemplateDlg

#include "lttw2.h"

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

HTWAINSESSION hSession;

/* handle to an existing TWAIN session */

L_TCHAR * lpszTemplateFile;

/* pointer to a character string */

LTWAINSAVECAPCALLBACK pfnCallBack;

/* optional callback function */

LTWAINSAVEERRORCALLBACK pfnErCallBack;

/* callback function */

L_VOID * pUserData;

/* pointer to more parameters for the callback */

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

Parameter

Description

hSession

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

lpsztemplateFile

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

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.

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.

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

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

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_TwainOpenTemplateFile, L_TwainAddCapabilityToFile, L_TwainGetCapabilityFromFile, L_TwainGetNumOfCapsInFile, L_TwainCloseTemplateFile, L_TwainInitSession, L_TwainEndSession.

Topics:

Handling Template Files

 

TWAIN Functionality: Template File Functions.

Example

L_INT EXT_CALLBACK BeforeSave (HTWAINSESSION hSession, pTW_CAPABILITY ptwCap, L_VOID * pData) 
{
   // Do pre operations on data to save
   return SUCCESS; 
}

L_INT EXT_CALLBACK SaveError (HTWAINSESSION hSession, pTW_CAPABILITY ptwCap, L_UINT uError, L_VOID * pData) 
{
   // Do the error handling
   return SUCCESS; 
}

void TestTemplateDlg(L_TCHAR L_FAR * pszFileName)
{
   L_INT nRet = L_TwainTemplateDlg (g_hSession, pszFileName, BeforeSave, SaveError, NULL);
   if (nRet != SUCCESS) 
   {
      // Error check procedure
   }
}