LTwain::GetNumericContainerValue

Summary

Gets the specified value from a container.

Syntax

#include "ltwrappr.h"

virtual L_INT LTwain::GetNumericContainerValue (pCapability, nIndex, ppValue)

Parameters

TW_CAPABILITY * pCapability

Pointer to a structure that contains the capability container value to get.

L_INT nIndex

Index of the value to get. Possible values are:

Value Meaning
LTWAIN_VALUE_COUNT [-1] Update ppValue 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 ppValue with the current value of the container. If the container is of type TW_RANGE, ppValue is updated with the CurrentValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ppValue 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 ppValue with the default value of the container. If the container is of type TW_RANGE, ppValue is updated with the DefaultValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ppValue 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 ppValue with the minimum value of the container. If the container is of type TW_RANGE, ppValue 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 ppValue with the maximum value of the container. If the container is of type TW_RANGE, ppValue 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 ppValue with the step size of the container. If the container is of type TW_RANGE, ppValue is updated with the StepSize member of the TW_RANGE structure. If the container is of any other type, the function will return an error code.
> = 0 Update ppValue with the value at the specified index. If the container is of type TW_ONEVALUE, nIndex must be zero and ppValue will be updated with the value of the TW_ONEVALUE structure. If the container is of type TW_ARRAY or TW_ENUMERATION, ppValue 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.

L_VOID ** ppValue

Variable to be allocated by the function and updated with the specified value. The user must free this value using the Windows C APIs GlobalUnlock and GlobalFree functions.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Required DLLs and Libraries

See Also

Functions

Topics

Example

// initialize session and call this function 
 
L_INT LTwain__GetNumericContainerValueExample(LTwain *MyClass) 
{ 
   L_INT          nRet; 
   L_UINT16*      pVal = NULL; 
   TW_CAPABILITY  twCap;  
 
   twCap.Cap = ICAP_XFERMECH;  
 
   twCap.ConType = TWON_DONTCARE16;  
 
   nRet = MyClass->GetCapability(&twCap, LTWAIN_CAPABILITY_GETCURRENT);  
   if (nRet != SUCCESS)  
 
   { 
 
      MessageBox (NULL, TEXT("Failed to get capability"), TEXT("ERROR"), MB_OK);  
 
      return nRet; 
 
   } 
 
   if (twCap.ConType == TWON_ONEVALUE) 
   { 
 
      nRet = MyClass->GetNumericContainerValue(&twCap, 0, (L_VOID **)&pVal); 
      if(nRet != SUCCESS) 
         return nRet; 
 
   } 
 
   else 
   { 
 
      nRet = MyClass->GetNumericContainerValue(&twCap, LTWAIN_VALUE_CURRENT, (L_VOID **)&pVal);  
      if(nRet != SUCCESS) 
         return nRet; 
 
   } 
 
 
   return SUCCESS;  
 
} 
Help Version 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS TWAIN C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.