AcquireMulti Example for Visual Basic

Dim WithEvents RasterTwain As LEADRasterTwain_U

Private Sub TwainAcquire_Click()
	Dim nRet As Integer

	Set RasterTwain = New LEADRasterTwain_U
	RasterTwain.UnlockSupport L_SUPPORT_DOCUMENT, "test key"
	RasterTwain.InitSession hWnd
	RasterTwain.SelectSource
	RasterTwain.FastTransferMode = L_LTWAIN_BUFFER_MODE
	RasterTwain.FastFormat = FILE_TIF
	RasterTwain.FastBitsPerPixel = 1
	RasterTwain.FastBufferSize = 0
	RasterTwain.FastUsePreferredBufferSize = True
	RasterTwain.EnableAcquireMultiEvent = True

	nRet = RasterTwain.AcquireMulti("c:\test.tif", L_LTWAIN_SHOW_USER_INTERFACE, True)

	If nRet = 0 Then
		MsgBox "The Fast Twain method was successful", vbOKOnly, "Notice"
	Else
		MsgBox "Error occurred during the fast Twain method!!!", vbOKOnly, "Error!!!"
	End If
End Sub

Private Sub RasterTwain_AcquireMultiEvent(ByVal nPage As Integer, ByVal bstrFileName As String, ByVal bFinishScan As Boolean)
	Dim strMsg As String

	If bFinishScan Then
		strMsg = "The page # " + CStr(nPage) + " is scanned and saved to file name " + bstrFileName
		MsgBox strMsg
	End If
End Sub