Sets the image unit value used to transfer images from the current TWAIN source.
#include "lttwn.h"
L_LTTWN_API L_INT L_TwainSetImageUnit(hSession, nUnit)
Handle to an existing TWAIN session. This handle is obtained by calling the L_TwainInitSession or L_TwainInitSession2 function.
Specifies the unit value to set. For more information on possible values, refer to the TWAIN specification.
| Value | Meaning |
|---|---|
| SUCCESS | The function was successful. |
| < 1 | An error occurred. Refer to Return Codes. |
This function internally sets the image unit capability ICAP_UNITS. For more information on this capability, refer to the TWAIN specification.
To obtain the current image unit value, call the L_TwainGetImageUnit function
This function should be called after calling the L_TwainStartCapsNeg function and before calling the L_TwainEndCapsNeg function.
L_INT TwainSetImageUnitExample(HTWAINSESSION hSession){L_INT nRet = SUCCESS;nRet = L_TwainStartCapsNeg (hSession);if(nRet != SUCCESS)return nRet;L_INT nUnit;nRet = L_TwainGetImageUnit (hSession, &nUnit);if (nRet == SUCCESS){if (nUnit != TWUN_INCHES){nRet = L_TwainSetImageUnit(hSession, TWUN_INCHES);if(nRet != SUCCESS)return nRet;}}elsereturn nRet;L_INT nBPP;nRet = L_TwainGetImageBitsPerPixel (hSession, &nBPP);if (nRet == SUCCESS){if (nBPP != 24){nRet = L_TwainSetImageBitsPerPixel (hSession, 24);if(nRet != SUCCESS)return nRet;}}elsereturn nRet;nRet = L_TwainEndCapsNeg (hSession);if(nRet != SUCCESS)return nRet;return SUCCESS;}