CapArray Example for Visual Basic

Dim RasterTwain As New LEADRasterTwain_U
Dim CapVal As New LEADRasterVariant_U
Dim TwainCap As New LEADTwainCapability_U
Dim iRet As Integer

RasterTwain.InitSession hWnd
RasterTwain.SelectSource

TwainCap.CapInfo.ConType = L_TWON_ARRAY
TwainCap.CapInfo.Capability = L_ICAP_FILTER
TwainCap.EnableMethodErrors = False

TwainCap.CapArray.ArrayItemType = L_TWTY_UINT16
TwainCap.CapArray.ArrayNumOfItems = 2

CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWFT_RED
TwainCap.CapArray.ArrayCapValue(0) = CapVal
CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWFT_GREEN
TwainCap.CapArray.ArrayCapValue(1) = CapVal

iRet = RasterTwain.SetCapability2(TwainCap, L_LTWAIN_CAPABILITY_SET)
If (iRet <> 0) Then
	MsgBox "Error Setting Capability"
End If

Set TwainCap = Nothing