Gets the custom data of a TWAIN data source and saves it to a file.
This feature is available in version 16 or higher.
#include "lttwn.h"
L_LTTWN_API L_INT EXT_FUNCTION L_TwainGetCustomDSData(hSession, pCustomData, pszFileName)
Handle to an existing TWAIN session. This handle is obtained by calling the L_TwainInitSession or L_TwainInitSession2 function.
Pointer to a TW_CUSTOMDSDATA structure. This structure must be allocated and it will be filled with custom data source data. For more information, refer to the TWAIN specification.
Character string that contains file name to save the custom data of TWAIN data source to. Pass NULL to not save the data to a file.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This function should be called after calling the L_TwainStartCapsNeg function and before calling the L_TwainEndCapsNeg function.
To update the custom data of a TWAIN data source, call the L_TwainSetCustomDSData function.
To save the custom data of TWAIN data source to a file, pass a valid file name to pszFileName. If you pass NULL, the data will return only to pCustomData. Also, you should pass valid pointer to TW_CUSTOMDSDATA to pCustomData.
L_INT TwainGetCustomDSDataExample(HTWAINSESSION hSession, L_TCHAR * pszFileName)
{
L_TwainStartCapsNeg(hSession);
L_INT nRet;
TW_CUSTOMDSDATA twData;
memset(&twData, 0, sizeof(TW_CUSTOMDSDATA));
nRet = L_TwainGetCustomDSData(hSession, &twData, pszFileName);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get custom data source data"), TEXT("ERROR"), MB_OK);
return nRet;
}
L_TwainEndCapsNeg(hSession);
return SUCCESS;
}