L_TwainQueryProperty

#include "lttw2.h"

L_INT EXT_FUNCTION L_TwainQueryProperty (hSession, uCapability, ppltProperty)

HTWAINSESSION hSession;

/* handle to an existing TWAIN session */

L_UINT uCapability;

/* capability constant */

pLTWAINPROPERTYQUERY * ppltProperty;

/* pointer to a pointer to a structure */

L_UINT uStructSize;

/* size, in bytes, of the structure pointed to by ppltProperty */

Gets the available property values.

Parameter

Description

hSession

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

uCapability

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

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 L_TwainFreePropQueryStructure function.

uStructSize

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

Returns

SUCCESS

The function was successful.

! = SUCCESS

An error occurred. Refer to Return Codes.

Comments

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

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_TwainGetProperties, L_TwainSetCapability, L_TwainGetCapability, L_TwainInitSession, L_TwainEndSession.

Topics:

Getting and Setting Capabilities

 

TWAIN Functionality: Property Functions.

Example

L_INT CheckCapability (L_INT16 uValue) 
{
   L_INT nRet, nIndex; 
   pLTWAINPROPERTYQUERY pltQuery = NULL; 

   // Query capability possible values
   nRet = L_TwainQueryProperty (g_hSession, 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)
         {
            L_TwainFreePropQueryStructure(&pltQuery); 
            return SUCCESS; 
         }
      }
      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)
            {
               L_TwainFreePropQueryStructure (&pltQuery); 
               return SUCCESS; 
            }
         }
      }
      break; 
   }

   L_TwainFreePropQueryStructure (&pltQuery); 
   return FAILURE; 
}