PtwInfo Example for Visual Basic

Dim WithEvents RasterTwain As LEADRasterTwain_U

Private Sub RasterTwain_AcquirePageEvent(ByVal pBitmap As Long)
	' This sample code is for the AcquirePageEvent handler
	' For another example, refer to the tutorials
	Dim nRet As Integer, n As Integer
	Dim Item As New LEADRasterVariant_U
	Dim twExt As New twExtImageInfo_U

	If (Not twExt Is Nothing) Then
		twExt.NumOfInfos = 1
		twExt.ptwInfo(0).InfoID = L_TWEI_BARCODETEXT
		twExt.ptwInfo(0).ItemType = L_TWTY_UINT32
		nRet = RasterTwain.GetExtImageInfo(twExt)
		If (nRet = 0) Then
			If (twExt.ptwInfo(0).CondCode = L_TWCC_SUCCESS) Then
				For n = 0 To twExt.ptwInfo(0).NumOfItems - 1 Step 1
					Item = twExt.ptwInfo(0).Item(n, 0)
					' Do more processing on the item value
				Next n
			End If
		End If
	End If
End Sub

Private Sub TwainAcquire_Click()
	Set RasterTwain = New LEADRasterTwain_U
	RasterTwain.InitSession hWnd
	RasterTwain.SelectSource
	RasterTwain.Acquire L_LTWAIN_SHOW_USER_INTERFACE
End Sub