FastConfigEvent Example for Visual Basic

Dim WithEvents RasterTwain As LEADRasterTwain_U

Private Sub RasterTwain_FastConfigEvent(ByVal pltResConfig As LTRASTERTWAINLib_U.ILTFastConfig_U)
	Dim str As String
	If pltResConfig.Success Then
		str = "Transfer Mode = " + CStr(pltResConfig.TransferMode) + Chr(13) + _
		"File Format = " + CStr(pltResConfig.FileFormat) + Chr(13) + _
		"Buffer Size = " + CStr(pltResConfig.BufferSize) + Chr(13) + _
		"Bits Per Pixel = " + CStr(pltResConfig.BitsPerPixel) + Chr(13) + _
		"Required Time = " + CStr(pltResConfig.RequiredTime)

		MsgBox str, vbOKOnly, "Resulting Scan Configurations..."
	Else
		MsgBox "The tested scan configuration failed…"
	End If
	RasterTwain.StopFindFastConfig = False
End Sub

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.EnableFastConfigEvent = True
	RasterTwain.FindFastConfig "c:\Twain", L_LTWAIN_SHOW_USER_INTERFACE, 1, 1
End Sub