L_TwainCreateNumericContainerRange

#include "lttwn.h"

L_LTTWN_API L_INT L_TwainCreateNumericContainerRange (pCapability, Type, uMinValue, uMaxValue, uStepSize, uDefaultValue, uCurrentValue)

TW_CAPABILITY * pCapability;

/* pointer to a structure */

LTWAINNUMERICTYPE Type;

/* container type */

L_UINT32 uMinValue;

/* minimum range value */

L_UINT32 uMaxValue;

/* maximum range value */

L_UINT32 uStepSize;

/* step size of the range */

L_UINT32 uDefaultValue;

/* range default value */

L_UINT32 uCurrentValue;

/* range current value */

Allocates the hContainer member of the TW_CAPABILITY structure to be type TW_RANGE and fills it with the appropriate data.

Parameter

Description

pCapability

Pointer to a structure that contains the capability container to allocate as type TW_RANGE.

Type

Type of data contained in the TW_RANGE container. For a list of possible values, refer to LTWAINNUMERICTYPE.

uMinValue

The minimum value of the range.

uMaxValue

The maximum value of the range.

uStepSize

The step size value of the range.

uDefaultValue

The default value of the range.

uCurrentValue

The current value of the range.

Returns

SUCCESS

The function was successful.

! = SUCCESS

An error occurred. Refer to Return Codes.

Comments

When enumerating and getting capabilities, the toolkit takes care of creating the necessary TW_CAPABILITY containers. However, if the user wants to set a capability using the L_TwainSetCapability function, he or she must declare a TW_CAPABILITY container of the appropriate type (TW_ARRAY, TW_ENUMERATION, TW_RANGE, or TW_ONEVALUE).

The step size is the amount of increase from one step to the next within the range uMinVal to uMaxVal. For example, if uMinValue = 0, uMaxValue = 100, and uStepSize = 2, then it will take 50 steps to increase from 0 to 100.

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_TwainFreeContainer, L_TwainCreateNumericContainerOneValue, L_TwainCreateNumericContainerEnum, L_TwainCreateNumericContainerArray, L_TwainLockContainer, L_TwainUnlockContainer, L_TwainFloatToFix32

Topics:

How to Work with the Containers

 

TWAIN Functionality: Container Functions.

Example

L_INT TwainCreateNumericContainerRangeExample(HTWAINSESSION g_hSession)
{
   L_INT nRet;
   TW_CAPABILITY twCap;

   memset (&twCap, 0, sizeof(TW_CAPABILITY));
   twCap.Cap = ICAP_XRESOLUTION;
   twCap.ConType = TWON_RANGE;

   nRet = L_TwainCreateNumericContainerRange(&twCap, TWAINNUMERICTYPE_TW_FIX32, 100, 600, 100, 200, 300);
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_TwainStartCapsNeg(g_hSession);
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_TwainSetCapability(g_hSession, &twCap, LTWAIN_CAPABILITY_SET);
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_TwainFreeContainer(&twCap);
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_TwainEndCapsNeg(g_hSession);
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}