CapRange Example for Visual FoxPro 6
#define L_LTWAIN_CAPABILITY_SET 1
#define L_TWON_RANGE 6
#define L_ICAP_JPEGQUALITY 4435
#define L_TWTY_INT16 1
#define L_TWJQ_MEDIUM (-2)
#define L_TWJQ_HIGH (-1)
oTwainCap.CapInfo.ConType = L_TWON_RANGE
oTwainCap.CapInfo.Capability = L_ICAP_JPEGQUALITY
oTwainCap.EnableMethodErrors = .F.
#define VALUE_USHORT 4
CapVal = CreateObject("LEADRasterVariant.LEADRasterVariant.145")
CapVal.Type = VALUE_USHORT
oTwainCap.CapRange.RangeItemType = L_TWTY_INT16
CapVal.LongValue = L_TWJQ_MEDIUM
oTwainCap.CapRange.RangeCurrentValue = CapVal
CapVal.LongValue = L_TWJQ_HIGH
oTwainCap.CapRange.RangeDefaultValue = CapVal
CapVal.LongValue = 0
oTwainCap.CapRange.RangeMinimumValue = CapVal
CapVal.LongValue = 50
oTwainCap.CapRange.RangeMaximumValue = CapVal
CapVal.LongValue = 10
oTwainCap.CapRange.RangeStepSize = CapVal
iRet = oRasterTwain.SetCapability2(oTwainCap, L_LTWAIN_CAPABILITY_SET)
If iRet <> 0 Then
MessageBox("Error Setting Capability"+Str(iRet))
EndIf