Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.23
LEADTOOLS TWAIN C DLL Help

L_TwainSetTransferOptions

Show in webframe

#include "lttwn.h"

L_LTTWN_API L_INT L_TwainSetTransferOptions(hSession, pTransferOpts)

HTWAINSESSION hSession;

/* handle to an existing TWAIN session */

pTRANSFEROPTIONS pTransferOpts;

/* pointer to a structure */

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

Parameter

Description

hSession

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

pTransferOpts

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

Returns

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

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_TwainGetTransferOptions, L_TwainGetSupportedTransferMode, L_TwainSetResolution, L_TwainGetResolution, L_TwainSetImageFrame, L_TwainGetImageFrame, L_TwainSetImageUnit, L_TwainGetImageUnit, L_TwainSetImageBitsPerPixel, L_TwainGetImageBitsPerPixel, L_TwainSetImageEffects, L_TwainGetImageEffects, L_TwainSetAcquirePageOptions, L_TwainGetAcquirePageOptions, L_TwainSetRGBResponse, L_TwainShowProgress, L_TwainEnableDuplex, L_TwainGetDuplexOptions, L_TwainSetMaxXferCount, L_TwainGetMaxXferCount

Topics:

Getting and Setting Capabilities

 

TWAIN Functionality: Capability Functions

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName


L_INT TwainSetTransferOptionsExample(HTWAINSESSION hSession)
{
   L_INT nRet = SUCCESS;

   L_TwainStartCapsNeg (hSession);

   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));
   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;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.