CapArray Example for Visual FoxPro 6

#define L_LTWAIN_CAPABILITY_SET 1
#define L_TWTY_UINT16 4
#define L_TWON_ARRAY 3
#define L_ICAP_FILTER 4358
#define L_TWFT_RED 0
#define L_TWFT_GREEN 1

oTwainCap.CapInfo.ConType = L_TWON_ARRAY
oTwainCap.CapInfo.Capability = L_ICAP_FILTER
oTwainCap.EnableMethodErrors = .F.

oTwainCap.CapArray.ArrayItemType = L_TWTY_UINT16
oTwainCap.CapArray.ArrayNumOfItems = 2

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

oTwainCap.CapArray.ArrayCapValue(0) = CapVal
CapVal.LongValue = L_TWFT_GREEN
oTwainCap.CapArray.ArrayCapValue(1) = CapVal

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