LTWAINTEMPLATECALLBACK Function

#include "lttwn.h"

L_INT pEXT_CALLBACK YourFunction (hSession, pCapability, nStatus, pUserData)

HTWAINSESSION hSession;

/* handle to an existing TWAIN session */

pTW_CAPABILITY * pCapability;

/* pointer to a capability */

L_INT nStatus;

/* indicates success or error code */

L_VOID * pUserData;

/* pointer to additional parameters */

Called for each capability being loaded from the template file or saved from the TWAIN source. The address of this callback is passed as an argument L_TwainLoadTemplateFile and L_TwainSaveTemplateFile.

Parameter

Description

hSession

Handle to an existing TWAIN session.

pCapability

Pointer to a TW_CAPABILITY structure that contains the capability.  For information on this structure, refer to www.twain.org and click on TWAIN Specification.

nStatus

When used with L_TwainLoadTemplateFile, nStatus refers to whether pCapability was set successfully.  When used with L_TwainSaveTemplateFile, nStatus refers to whether the pCapability was successfully added to the template file.

pUserData

A void pointer that you can use to access a variable or structure containing data that your callback function needs. This gives you a way to receive data indirectly from the function that uses this callback function. (This is the same pointer that you pass in the pUserData parameter of L_TwainLoadTemplateFile or L_TwainSaveTemplateFile.)

 

Keep in mind that this is a void pointer, which must be cast to the appropriate data type within your callback function.

Returns

TWAIN_SUCCESS

The function was successful.

TWAIN_SUCCESS_ABORT

The callback wants to abort the operation.

< 1

An error occurred. Refer to Return Codes.

Comments

Use this callback to alert the user of any failures in setting a capability when loaded from a template file.  You can also use this callback to provide a listing of all capabilities and their possible values found in a template file or being saved to a template 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_TwainLoadTemplateFile, L_TwainSaveTemplateFile

Topics:

TWAIN Functionality: Callbacks

Example

For an example, refer to L_TwainSaveTemplateFile.