L_TwainGetProperties

Summary

Gets the current or default values of the properties defined in the LTWAINPROPERTIES structure.

Syntax

#include "lttwn.h"

L_LTTWN_API L_INT L_TwainGetProperties (hSession, pltProperties, uStructSize, uFlags)

Parameters

HTWAINSESSION hSession

Handle to an existing TWAIN session. This handle is obtained by calling the L_TwainInitSession or L_TwainInitSession2 function.

pLTWAINPROPERTIES 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.

L_UINT uStructSize

Size in bytes, of the structure pointed to by pltProperties, for versioning. Use sizeof(LTWAINPROPERTIES).

L_UINT 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

Value Meaning
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

See Also

Functions

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, MAKE_IMAGE_PATH(TEXT("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; 
} 
Help Version 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS TWAIN C API Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.