L_TwainCreateNumericContainerEnum

#include "lttwn.h"

L_LTTWN_API L_INT L_TwainCreateNumericContainerEnum (pCapability, Type, uNumOfItems, uCurrentIndex, uDefaultIndex, pData)

TW_CAPABILITY * pCapability;

/* pointer to a structure */

LTWAINNUMERICTYPE Type;

/* container type */

L_UINT32 uNumOfItems;

/* number of enumeration items */

L_UINT32 uCurrentIndex;

/* current index */

L_UINT32 uDefaultIndex;

/* default index */

L_VOID * pData;

/* pointer to an allocated array */

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

Parameter

Description

pCapability

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

Type

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

uNumOfItems

Number of items in the enumeration.

uCurrentIndex

Index of the current value in the enumeration data.

uDefaultIndex

Index of the default value in the enumeration data.

pData

Pointer to an allocated array of type TW_ENUMERATION that has been initialized with the appropriate data and size information.

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).

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_TwainCreateNumericContainerRange, L_TwainCreateNumericContainerOneValue, L_TwainCreateNumericContainerArray, L_TwainLockContainer, L_TwainUnlockContainer, L_TwainFloatToFix32.

Topics:

How to Work with the Containers

 

TWAIN Functionality: Container Functions.

Example

static HTWAINSESSION g_hSession;

 L_INT TwainCreateNumericContainerEnumExample(L_VOID)
{
   L_INT nRet;
   TW_CAPABILITY twCap;
   L_UINT16 uItem[3];

   memset (&twCap, 0, sizeof(TW_CAPABILITY));
   twCap.Cap = ICAP_XFERMECH;
   twCap.ConType = TWON_ENUMERATION;

   uItem[0] = TWSX_FILE;
   uItem[1] = TWSX_MEMORY;
   uItem[2] = TWSX_NATIVE;

   nRet = L_TwainCreateNumericContainerEnum(&twCap, TWAINNUMERICTYPE_TW_UINT32, 3, TWSX_MEMORY, TWSX_NATIVE, (L_INT *)uItem);
   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;
}