L_TwainGetProperties
#include "lttwn.h"
L_LTTWN_API L_INT L_TwainGetProperties (hSession, pltProperties, uFlags)
|
HTWAINSESSION hSession; |
/* handle to an existing TWAIN session */ |
|
pLTWAINPROPERTIES pltProperties; |
/* pointer to a structure */ |
|
L_UINT uStructSize; |
/* size in bytes, of the structure pointed to by pBitmap */ |
|
L_UINT uFlags; |
/* optional flags */ |
Gets the current or default values of the properties defined in the LTWAINPROPERTIES structure.
|
Parameter |
Description |
|
|
hSession |
Handle to an existing TWAIN session. This handle is obtained by calling the L_TwainInitSession function. |
|
|
pltProperties |
Pointer to a LTWAINPROPERTIES structure to be updated with the current or default properties. This must be a valid pointer for an LTWAINPROPERTIES structure. |
|
|
uStructSize |
Size in bytes, of the structure pointed to by pltProperties, for versioning. Use sizeof(LTWAINPROPERTIES). |
|
|
uFlags |
Flag that indicates the property values to get. Possible values are: |
|
|
|
Value |
Meaning |
|
|
LTWAIN_PROPERTIES_GETCURRENT |
[3] Get the current values. |
|
|
LTWAIN_PROPERTIES_GETDEFAULT |
[4] Get the default values. |
Returns
|
SUCCESS |
The function was successful. |
|
! = SUCCESS |
An error occurred. Refer to Return Codes. |
Comments
This function must be called after L_TwainStartCapsNeg is called and before L_TwainEndCapsNeg is called.
This function lets the user get information on the properties contained in the LTWAINPROPERTIES structure. It is a high-level alternative to getting capabilities using the L_TwainGetCapability or L_TwainEnumCapabilities functions. For more information on getting and setting TWAIN capabilities, refer to Getting and Setting Capabilities.
To set properties, use the L_TwainSetProperties 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
|
Functions: |
L_TwainStartCapsNeg, L_TwainEndCapsNeg, L_TwainSetProperties, L_TwainSetCapability, L_TwainGetCapability, L_TwainInitSession, L_TwainEndSession. |
|
Topics: |
|
|
|
Example
L_INT EXT_CALLBACK PropSetCB(HTWAINSESSION hSession,
L_UINT uCap,
L_INT nStatus,
L_VOID * pValue,
L_VOID * pUserData)
{
UNREFERENCED_PARAMETER(hSession);
UNREFERENCED_PARAMETER(uCap);
UNREFERENCED_PARAMETER(nStatus);
UNREFERENCED_PARAMETER(pValue);
UNREFERENCED_PARAMETER(pUserData);
// Do your error notification or place any other code here.
return SUCCESS;
}
// Function to change the transfer mode to file
L_INT TwainGetPropertiesExample(HTWAINSESSION g_hSession)
{
L_INT nRet;
LTWAINPROPERTIES twProps;
// Initialize to zero
memset (&twProps, 0, LTWAINPROPERTIESSIZE);
// Get the current properties of the selected twain source
nRet = L_TwainGetProperties (g_hSession, &twProps, sizeof(LTWAINPROPERTIES), LTWAIN_PROPERTIES_GETCURRENT);
if (nRet != SUCCESS)
return nRet;
// Change transfer mode to File
twProps.DataTransfer.nTransferMode = TWSX_FILE;
lstrcpy (twProps.DataTransfer.szFileName, TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 15\\Images\\Twain.bmp"));
twProps.DataTransfer.nScanFileFormat = TWFF_BMP;
// Set the new properties
nRet = L_TwainSetProperties (g_hSession, &twProps, LTWAIN_PROPERTIES_SET, PropSetCB, NULL);
if (nRet != SUCCESS)
return nRet;
return SUCCESS;
}