L_TwainSetTransferOptions

#include "lttwn.h"

L_LTTWN_API L_INT L_TwainSetTransferOptions(hSession, pTransferOpts)

Sets the options used for transferring data from the current TWAIN source.

Parameters

HTWAINSESSION hSession

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

pTRANSFEROPTIONS pTransferOpts

Pointer to the TRANSFEROPTIONS structure that contains the transfer options to set.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

To obtain the current transfer options, call L_TwainGetTransferOptions function.

This function should be called after calling the L_TwainStartCapsNeg function and before calling the L_TwainEndCapsNeg function.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT TwainSetTransferOptionsExample(HTWAINSESSION hSession) 
{ 
   L_INT nRet = SUCCESS; 
 
   nRet = L_TwainStartCapsNeg (hSession); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   L_UINT TransferModes = 0; 
   nRet = L_TwainGetSupportedTransferMode (hSession, &TransferModes); 
   if (nRet == SUCCESS) 
   { 
      if ((TransferModes & TWAIN_TRANSFER_FILE) == TWAIN_TRANSFER_FILE) 
         MessageBox(NULL, TEXT("File transfer is supported"), TEXT("Notice!"), MB_OK); 
   } 
   else 
      return nRet; 
 
   TRANSFEROPTIONS TransOpts; 
   memset(&TransOpts, 0, sizeof(TRANSFEROPTIONS)); 
   nRet = L_TwainGetTransferOptions (hSession, &TransOpts, sizeof(TRANSFEROPTIONS)); 
   if (nRet == SUCCESS) 
   { 
      if (TransOpts.TransferMode != TWAIN_TRANSFER_FILE) 
      { 
         TransOpts.TransferMode = TWAIN_TRANSFER_FILE; 
         _tcscpy_s(TransOpts.szFileName, MAX_PATH, MAKE_IMAGE_PATH(TEXT("test.bmp"))); 
 
         TransOpts.uFileFormat = TWFF_BMP; 
      } 
 
      nRet = L_TwainSetTransferOptions(hSession, &TransOpts); 
      if(nRet != SUCCESS) 
         return nRet; 
   } 
   else 
      return nRet; 
 
   nRet = L_TwainEndCapsNeg(hSession); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

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