DTwainInterface::GetCapFromName

Top  Previous  Next

Syntax

#include <string>

static LONG DTwainInterface::GetCapFromName( const std::string& sName )

 

Parameters

sName

Specifies the name of the capability as either a std::string object or an LPCTSTR.

 

Return Value

If the function succeeds, the capability value defined by the TWAIN specification is returned.  If the function fails, -1 is returned.

 

Comments

The DTwainInterface::GetCapFromName function returns the TWAIN capability that matches the name supplied by sName.  For example if sName is the string "ICAP_BITDEPTH", GetCapFromName will return 4395, the value of the ICAP_BITDEPTH capability defined by the TWAIN specification.  The DTwainInterface::GetCapFromName functon is useful for cases where you need a LONG for the cap value, and your application has just the string version of the capability.  The returned value is also the same as one of the DTWAIN Capability Constants         (the DTWAIN_CV_... constants).

 

The name supplied can be a mixture of upper or lower case, and can have trailing or leading spaces.  However it must match exactly with one of the TWAIN capability names found in the TWAIN 1.8 specification.  For custom capabilities, the string must be "CAP_CUSTOMBASE + xxxx", where "xxxx" is the decimal representation of the arithmetic difference between the capability and 32,768.  For example, if the custom capability has a decimal value of 32,800, the following:

 

LONG CapValue = DTwainInterface::GetCapFromName("CAP_CUSTOMBASE + 32");

 

will return 32800 to CapValue.