CapOneValue 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

'Set units to inches
TwainCap.CapInfo.ConType = L_TWON_ONEVALUE
TwainCap.CapInfo.Capability = L_ICAP_UNITS
TwainCap.EnableMethodErrors = False

CapVal.Type = VALUE_USHORT
CapVal.LongValue = L_TWUN_INCHES

TwainCap.CapOneValue.OneValItemType = L_TWTY_UINT16
TwainCap.CapOneValue.OneValCapValue = CapVal

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

Set TwainCap = Nothing