LTwain::QueryProperty

Summary

Gets the available property values.

Syntax

#include "ltwrappr.h"

virtual L_INT LTwain::QueryProperty (uCapability, ppltProperty, uStructSize)

Parameters

L_UINT uCapability

This is a capability constant defined by the TWAIN specification. For example, if the user wants the value for the transfer count, the uCapability will be ICAP_XFERCOUNT.

pLTWAINPROPERTYQUERY * ppltProperty

Pointer to a pointer to a LTWAINPROPERTYQUERY structure to be updated with the property values.

The structure will be internally allocated if the function is successful. The structure should be freed by calling the LTwain::FreePropQueryStructure function.

L_UINT uStructSize

Size of the LTWAINPROPERTYQUERY structure, in bytes, for versioning. Use sizeof(LTWAINPROPERTYQUERY).

Returns

Value Meaning
SUCCESS The function was successful.
< An error occurred. Refer to Return Codes.

Comments

Getting these values can help in determining which values a certain TWAIN source supports for a certain capability or property.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT LTwain__QueryPropertyExample(L_INT16 uValue, CMyTwain *MyClass) 
{ 
   L_INT                nRet, nIndex;  
   pLTWAINPROPERTYQUERY pltQuery = NULL;  
 
   // Query capability possible values 
   nRet = MyClass->QueryProperty (ICAP_XRESOLUTION, &pltQuery , sizeof(LTWAINPROPERTYQUERY));  
   if (nRet != SUCCESS)  
      return nRet;  
 
   // Check for the available values of the file transfer property 
   switch (pltQuery->uType)  
   { 
   case TWON_ONEVALUE:  
      if (pltQuery->pltwOneValue->ItemType == TWTY_FIX32) 
      { 
         pTW_FIX32 ptwFixVal = (pTW_FIX32)&(pltQuery->pltwOneValue->Item); 
         if (ptwFixVal->Whole == uValue) 
         { 
            nRet = MyClass->FreePropQueryStructure(&pltQuery);  
            if(nRet != SUCCESS) 
               return nRet; 
         } 
      } 
      break; 
 
   case TWON_ENUMERATION:  
      if (pltQuery->pltwEnumeration->ItemType == TWTY_FIX32)  
      { 
         pTW_FIX32 ptwFixVal; 
         for (nIndex = 0; nIndex < (L_INT)pltQuery->pltwEnumeration->NumItems; nIndex ++) 
         { 
            ptwFixVal = (pTW_FIX32)(pltQuery->pltwEnumeration->ItemList[nIndex]); 
            if (ptwFixVal->Whole == uValue) 
            { 
               nRet = MyClass->FreePropQueryStructure (&pltQuery);  
               if(nRet != SUCCESS) 
                  return nRet; 
            } 
         } 
      } 
      break;  
   } 
 
   nRet = MyClass->FreePropQueryStructure (&pltQuery);  
 
   return nRet; 
} 
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++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.