L_TwainSetTransferOptions
#include "lttwn.h"
L_LTTWN_API L_INT L_TwainSetTransferOptions(hSession, pTransferOpts)
|
HTWAINSESSION hSession; |
/* handle to an existing TWAIN session */ |
|
pTRANSFEROPTIONS pTransferOpts; |
/* pointer to a structure */ |
Sets the options used for transferring data from the current TWAIN source.
|
Parameter |
Description |
|
hSession |
Handle to an existing TWAIN session. This handle is obtained by calling the L_TwainInitSession function. |
|
pTransferOpts |
Pointer to the TRANSFEROPTIONS structure that contains the transfer options to set. |
Returns
|
SUCCESS |
The function was successful. |
|
< 1 |
An error occurred. Refer to Return Codes. |
Comments
To obtain the current transfer options, call L_TwainGetTransferOptions 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. |
See Also
Example
L_INT TwainSetTransferOptionsExample(HTWAINSESSION hSession)
{
L_INT nRet = SUCCESS;
L_TwainStartCapsNeg (hSession);
L_UINT TransferModes = 0;
nRet = L_TwainGetSupportedTransferMode (hSession, &TransferModes);
if (nRet == SUCCESS)
{
if ((TransferModes & TWAIN_TRANSFER_FILE) == TWAIN_TRANSFER_FILE)
MessageBox(NULL, TEXT("File transfer is supported"), TEXT("Notice!"), MB_OK);
}
else
return nRet;
TRANSFEROPTIONS TransOpts;
memset(&TransOpts, 0, sizeof(TRANSFEROPTIONS));
L_TwainGetTransferOptions (hSession, &TransOpts, sizeof(TRANSFEROPTIONS));
if (nRet == SUCCESS)
{
if (TransOpts.TransferMode != TWAIN_TRANSFER_FILE)
{
TransOpts.TransferMode = TWAIN_TRANSFER_FILE;
_tcscpy_s(TransOpts.szFileName, MAX_PATH, TEXT("c:\\test.bmp"));
TransOpts.uFileFormat = TWFF_BMP;
}
nRet = L_TwainSetTransferOptions(hSession, &TransOpts);
if(nRet != SUCCESS)
return nRet;
}
else
return nRet;
nRet = L_TwainEndCapsNeg(hSession);
if(nRet != SUCCESS)
return nRet;
return SUCCESS;
}