L_TwainGetNumericContainerSTRINGValue

#include "lttwn.h"

L_LTTWN_API L_INT L_TwainGetNumericContainerSTRINGValue(pCapability, nIndex, twString)

Gets the specified value from a container.

Parameters

TW_CAPABILITY * pCapability

Pointer to a TW_CAPABILITY structure that references the container value to get.

L_INT nIndex

Index of the value to get. Possible values are:

Value Meaning
LTWAIN_VALUE_COUNT [-1] Update twString with the number of items in the item list of the specified container. This option is only valid if the container is of type TW_ARRAY or TW_ENUMERATION. If the container is of any other type, this function will return an error code.
LTWAIN_VALUE_CURRENT [-2] Update twString with the current value of the container. If the container is of type TW_RANGE, twString is updated with the CurrentValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, twString is updated with the CurrentIndex member of the TW_ENUMERATION structure. If the container is of any other type, the function will return an error code.
LTWAIN_VALUE_DEFAULT [-3] Update twString with the default value of the container. If the container is of type TW_RANGE, twString is updated with the DefaultValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, twString is updated with the DefaultIndex member of the TW_ENUMERATION structure. If the container is of any other type, the function will return an error code.
LTWAIN_VALUE_MINIMUM [-4] Update twString with the minimum value of the container. If the container is of type TW_RANGE, twString is updated with the MinValue member of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
LTWAIN_VALUE_MAXIMUM [-5] Update twString with the maximum value of the container. If the container is of type TW_RANGE, twString is updated with the MaxValue member of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
LTWAIN_VALUE_STEPSIZE [-6] Update twString with the step size of the container. If the container is of type TW_RANGE, twString is updated with the StepSize membr of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
>= 0 Update twString with the value at the specified index. If the container is of type TW_ONEVALUE, nIndex must be zero and twString will be updated with the value of the TW_ONEVALUE structure. If the container is of type TW_ARRAY or TW_ENUMERATION, twString will be updated with the value at the specified index in the list of items. If the container is of type TW_ENUMERATION or TW_ARRAY, the value must not exceed the number of items in the container's item list or the function will return an error code.

TW_STR1024 twString

A TW_STR1024 value to be updated with the specified container value.

Returns

Value Meaning
SUCCESS The function was successful.
! = SUCCESS An error occurred. Refer to Return Codes.

Comments

Use this function to get a value from a container's item list when the item list type is TW_STR1024.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT TwainGetNumericContainerSTRINGValueExample(L_INT nItemType,HTWAINSESSION hSession) 
{ 
   L_INT nRet; 
   TW_CAPABILITY twCap; 
   TW_STR1024 twString; 
 
   nRet = L_TwainStartCapsNeg(hSession); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   // Fill the TW_CAPABILITY structure with values 
   twCap.Cap = ICAP_HALFTONES; 
   twCap.ConType = TWON_ONEVALUE; 
   nRet = L_TwainGetCapability(hSession, &twCap, LTWAIN_CAPABILITY_GETCURRENT); 
   if (nRet != SUCCESS)  
   { 
      MessageBox (NULL, TEXT("Failed to get capability"), TEXT("ERROR"), MB_OK); 
      return nRet; 
   } 
 
   nRet = L_TwainGetNumericContainerItemType(&twCap, &nItemType); 
   if (nRet != SUCCESS) 
   { 
      MessageBox (NULL, TEXT("Failed to get capability item type"), TEXT("ERROR"), MB_OK); 
      return nRet; 
   } 
   else if ( (nItemType == TWTY_STR32) || (nItemType == TWTY_STR64) ||  
             (nItemType == TWTY_STR128) || (nItemType == TWTY_STR255) ||  
             (nItemType == TWTY_STR1024) ) 
   { 
      nRet = L_TwainGetNumericContainerSTRINGValue (&twCap, 0, twString); 
      if (nRet != SUCCESS) 
      { 
         MessageBox (NULL, TEXT("Failed to get capability item value"), TEXT("ERROR"), MB_OK); 
         return nRet; 
      } 
   } 
 
   nRet = L_TwainEndCapsNeg(hSession); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   return nRet; 
} 
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS TWAIN C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.