#include "lttwn.h"
L_LTTWN_API L_INT L_TwainSetImageUnit(hSession, nUnit)
HTWAINSESSION hSession; |
handle to an existing TWAIN session |
L_INT nUnit; |
image unit |
Sets the image unit value used to transfer images from the current TWAIN source.
Parameter |
Description |
hSession |
Handle to an existing TWAIN session. This handle is obtained by calling the L_TwainInitSession or L_TwainInitSession2 function. |
nUnit |
Specifies the unit value to set. For more information on possible values, refer to http://www.twain.org/ and click on TWAIN Specification (Version 1.9). |
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 www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).
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.
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. |
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;
}
}
else
return 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;
}
}
else
return nRet;
nRet = L_TwainEndCapsNeg (hSession);
if(nRet != SUCCESS)
return nRet;
return SUCCESS;
}