Capability Example for Visual Basic

Dim TwainCap As New LEADTwainCapability_U
Dim RasterTwain As New LEADRasterTwain_U
Dim strName As String
Dim lCount As Long
Dim lCapability As Long
Dim n As Integer
Dim CapVal As New LEADRasterVariant_U

RasterTwain.InitSession hWnd
RasterTwain.SelectSource
lCount = RasterTwain.CapsCount
For n = 0 To lCount - 1 Step 1
	lCapability = RasterTwain.Capability(n)

	' Check for capability and do other processing
	If lCapability = L_ICAP_XFERMECH Then
		TwainCap.EnableMethodErrors = False
		TwainCap.CapInfo.Capability = L_ICAP_XFERMECH
		TwainCap.CapInfo.ConType = L_TWON_ONEVALUE
		TwainCap.CapOneValue.OneValItemType = L_TWTY_UINT16
		'Set the transfer mechanism to file
		CapVal.Type = VALUE_USHORT
		CapVal.LongValue = L_TWSX_FILE
		TwainCap.CapOneValue.OneValCapValue = CapVal

		RasterTwain.SetCapability2 TwainCap, L_LTWAIN_CAPABILITY_SET
	End If
Next n