Gets the specified value from a container.
#include "ltwrappr.h"
virtual L_INT LTwain::GetNumericContainerFIX32Value(pCapability, nIndex, ptwFix)
Pointer to a TW_CAPABILITY structure that references the container value to get.
Index of the value to get. Possible values are:
Value | Meaning |
---|---|
LTWAIN_VALUE_COUNT | [-1] Update ptwFix 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 ptwFix with the current value of the container. If the container is of type TW_RANGE, ptwFix is updated with the CurrentValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ptwFix 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 ptwFix with the default value of the container. If the container is of type TW_RANGE, ptwFix is updated with the DefaultValue member of the TW_RANGE structure. If the container is of type TW_ENUMERATION, ptwFix 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 ptwFix with the minimum value of the container. If the container is of type TW_RANGE, ptwFix 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 ptwFix with the maximum value of the container. If the container is of type TW_RANGE, ptwFix 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 ptwFix with the step size of the container. If the container is of type TW_RANGE, ptwFix 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 ptwFix with the value at the specified index. If the container is of type TW_ONEVALUE, nIndex must be zero and ptwFix will be updated with the value of the TW_ONEVALUE structure. If the container is of type TW_ARRAY or TW_ENUMERATION, ptwFix 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. |
Pointer to a TW_FIX32 value to be updated with the specified container value.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Use this function to get a value from a container's item list when the item list type is TW_FIX32.
// initialize session and call this function
L_INT LTwain__GetNumericContainerFIX32ValueExample(LTwain *MyClass)
{
L_INT nRet;
L_INT nItemType;
TW_FIX32 twFix;
TW_CAPABILITY twCap;
// Fill the TW_CAPABILITY structure with values
twCap.Cap = ICAP_BRIGHTNESS;
twCap.ConType = TWON_ONEVALUE;
nRet = MyClass->GetCapability(&twCap, LTWAIN_CAPABILITY_GETCURRENT);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability"), TEXT("ERROR"), MB_OK);
return nRet;
}
nRet = MyClass->GetNumericContainerItemType(&twCap, &nItemType);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability item type"), TEXT("ERROR"), MB_OK);
return nRet;
}
else if (nItemType == TWTY_BOOL)
{
nRet = MyClass->GetNumericContainerFIX32Value (&twCap, 0, &twFix);
if (nRet != SUCCESS)
{
MessageBox (NULL, TEXT("Failed to get capability item value"), TEXT("ERROR"), MB_OK);
return nRet;
}
}
return SUCCESS;
}