CapEnum Example for Visual FoxPro 6
#define L_TWTY_UINT16 4
#define L_LTWAIN_CAPABILITY_SET 1
#define L_ICAP_UNITS 258
#define L_TWUN_INCHES 0
#define L_TWUN_TWIPS 4
#define L_TWON_ENUMERATION 4
oTwainCap.CapInfo.ConType = L_TWON_ENUMERATION
oTwainCap.CapInfo.Capability = L_ICAP_UNITS
oTwainCap.EnableMethodErrors = .F.
oTwainCap.CapEnum.EnumNumOfItems = 2
#define VALUE_USHORT 4
CapVal = CreateObject("LEADRasterVariant.LEADRasterVariant.145")
CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWUN_INCHES
oTwainCap.CapEnum.EnumCapValue(0) = CapVal
CapVal.LongValue = L_TWUN_TWIPS
oTwainCap.CapEnum.EnumCapValue(1) = CapVal
oTwainCap.CapEnum.EnumCurrentIndex = 0
oTwainCap.CapEnum.EnumDefaultIndex = 0
oTwainCap.CapEnum.EnumItemType = L_TWTY_UINT16
iRet = oRasterTwain.SetCapability2(oTwainCap, L_LTWAIN_CAPABILITY_SET)
If iRet <> 0 Then
MessageBox("Error Setting Capability:"+Str(iRet))
EndIf