L_TwainSetImageFrame

#include "lttwn.h"

L_LTTWN_API L_INT L_TwainSetImageFrame(hSession, pFrame)

HTWAINSESSION hSession;

/* handle to an existing TWAIN session */

pTW_FRAME pFrame;

/* pointer to a structure */

Sets the image frame used when transferring images from the current TWAIN source.

Parameter

Description

hSession

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

pFrame

Pointer to a variable that contains the image frame value to set.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The image frame specifies the size and location of the image to acquire. To obtain the current image frame value, call the L_TwainGetImageFrame 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_TwainSetTransferOptions, L_TwainGetTransferOptions, L_TwainGetSupportedTransferMode, L_TwainSetResolution, L_TwainGetResolution, 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

TW_FIX32 FloatToTWFix32 (L_FLOAT Floater)
{
   TW_FIX32 Fix32;
   TW_INT32 Int32 = (TW_INT32)(Floater * 65536.0 + 0.5);
   Fix32.Whole = (TW_INT16) (Int32 >> 16);
   Fix32.Frac = (TW_UINT16) (Int32 & 0x0000FFFFL);

   return Fix32;
}

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

   L_TwainStartCapsNeg (hSession);
   TW_FRAME frame;
   nRet = L_TwainGetImageFrame (hSession, &frame);
   if (nRet == SUCCESS)
   {
      frame.Left = FloatToTWFix32(0);
      frame.Top = FloatToTWFix32(0);
      frame.Right = FloatToTWFix32(8.5);
      frame.Bottom = FloatToTWFix32(11);

      nRet = L_TwainSetImageFrame(hSession, &frame);
      if(nRet != SUCCESS)
         return nRet;
   }
   else
      return nRet;

   nRet = L_TwainEndCapsNeg (hSession);
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}