Gets the current or default values of the properties defined in the LTWAINPROPERTIES structure.
#include "ltwrappr.h"
virtual L_INT LTwain::GetProperties (pltProperties, uStructSize, uFlags)
Pointer to a LTWAINPROPERTIES structure to be updated with the current or default properties. This must be a valid pointer for an LTWAINPROPERTIES structure.
Size of the LTWAINPROPERTIES structure, in bytes, for versioning. Use sizeof(LTWAINPROPERTIES).
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. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
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 LTwain::GetCapability or LTwain::EnumCapabilities functions. For more information on getting and setting TWAIN capabilities, refer to Getting and Setting Capabilities.
To set properties, use the LTwain::SetProperties function.
L_INT CMyTwain::SetPropertyCallBack(L_UINT uCap, L_INT nStatus, L_VOID * pValue)
{
UNREFERENCED_PARAMETER(uCap);
UNREFERENCED_PARAMETER(nStatus);
UNREFERENCED_PARAMETER(pValue);
// Do you error notification or any other code here.
return SUCCESS;
}
// Function to change the transfer mode to file
L_INT LTwain__GetPropertiesExample(CMyTwain *MyClass)
{
L_INT nRet;
LTWAINPROPERTIES twProps;
// Initialize to zero
memset (&twProps, 0, LTWAINPROPERTIESSIZE);
twProps.ImageRes.uStructSize = IMAGERESOLUTIONSIZE;
twProps.DataTransfer.uStructSize = DATATRANSFERSIZE;
twProps.ImageEff.uStructSize = IMAGEEFFECTSSIZE;
// Get the current properties of the selected twain source
nRet = MyClass->GetProperties(&twProps, LTWAINPROPERTIESSIZE,LTWAIN_PROPERTIES_GETCURRENT);
if (nRet != SUCCESS)
return nRet;
// Change transfer mode to File
twProps.DataTransfer.nTransferMode = TWSX_FILE;
lstrcpy (twProps.DataTransfer.szFileName, MAKE_IMAGE_PATH(TEXT("Twain.bmp")));
twProps.DataTransfer.nScanFileFormat = TWFF_BMP;
// Set the new properties
MyClass->EnableCallBack (TRUE);
nRet = MyClass->SetProperties(&twProps, LTWAIN_PROPERTIES_SET);
if (nRet != SUCCESS)
return nRet;
return SUCCESS;
}