CapOneValue Example for Visual FoxPro 6

#define L_TWON_ONEVALUE 5
#define L_LTWAIN_CAPABILITY_SET 1
#define L_TWTY_UINT16 4
#define L_ICAP_UNITS 258
#define L_TWUN_INCHES 0

oTwainCap.CapInfo.ConType = L_TWON_ONEVALUE
oTwainCap.CapInfo.Capability = L_ICAP_UNITS
oTwainCap.EnableMethodErrors = .F.

#define VALUE_USHORT 4 
CapVal = CreateObject("LEADRasterVariant.LEADRasterVariant.145")
CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWUN_INCHES

oTwainCap.CapOneValue.OneValItemType = L_TWTY_UINT16
oTwainCap.CapOneValue.OneValCapValue = CapVal

iRet = oRasterTwain.SetCapability2(oTwainCap, L_LTWAIN_CAPABILITY_SET)
If iRet <> 0 Then
   MessageBox("Error Setting Capability")
EndIf