LTwain::CreateNumericContainerArray

#include "ltwrappr.h"

virtual L_INT LTwain::CreateNumericContainerArray (pCapability, Type, uNumOfItems, pData)

TW_CAPABILITY * pCapability;

/* pointer to a structure */

LTWAINNUMERICTYPE Type;

/* container type */

L_UINT32 uNumOfItems;

/* number of items in the array */

L_VOID * pData;

/* pointer to an allocated array */

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

Parameter

Description

pCapability

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

Type

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

uNumOfItems

Number of items in the array.

pData

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

Returns

SUCCESS

The function was successful.

< 1

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 LTwain::SetCapability 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:

LTwain::FreeContainer, LTwain::CreateNumericContainerRange, LTwain::CreateNumericContainerOneValue, LTwain::CreateNumericContainerEnum, LTwain::LockContainer, LTwain::UnlockContainer.

Topics:

How to Work with the Containers

 

TWAIN Functionality: Container Functions.

Example

// initialize session and call this function
L_INT LTwain__CreateNumericContainerArrayExample(LTwain *MyClass)
{
   L_INT          nRet;
   TW_CAPABILITY  twCap;
   L_INT          nItem[3];
   memset (&twCap, 0, sizeof(TW_CAPABILITY)); 
   twCap.Cap = ICAP_FILTER;
   twCap.ConType = TWON_ARRAY;
   nItem[0] = TWFT_RED;
   nItem[1] = TWFT_GREEN;
   nItem[2] = TWFT_BLUE;
   nRet = MyClass->CreateNumericContainerArray(&twCap, TWAINNUMERICTYPE_TW_UINT32, 3, (L_VOID *)nItem);
   if(nRet != SUCCESS)
      return nRet;
   nRet = MyClass->SetCapability(&twCap, LTWAIN_CAPABILITY_SET);
   if(nRet != SUCCESS)
      return nRet;
   nRet = MyClass->FreeContainer(&twCap);
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}