Get a Fast Twain Scan from a Scanner (Visual FoxPro 6)

Take the following steps to start a project and to add some code to find the fastest configuration for your scanner using the LEADTOOLS Fast TWAIN feature:

1.

Start with the project you created in Using the Fast TWAIN Feature (Visual FoxPro 6)

2.

Add 2 command buttons to the project's form as follows:

 

Name

Caption

 

FindFastConfig

Find Fast Config

 

AcquireFastConfig

Acquire Fast Config

3.

Code the "Find Fast Config" Click procedure as follows:

#define L_LTWAIN_SHOW_USER_INTERFACE 1
#define L_LTWAIN_USE_THREAD_MODE 8
oRasterTwain.UserFastConfigsCount = 0
oRasterTwain.EnableFastConfigEvent = .F.
nRet = oRasterTwain.FindFastConfig("c:\temp", BitOR(L_LTWAIN_SHOW_USER_INTERFACE, L_LTWAIN_USE_THREAD_MODE), 8, 5)
If nRet = 0 Then
   MessageBox("Find Fast Configuration process completed")
Else
   MessageBox("An error occurred while Finding the Fast Configuration")
EndIf

4.

Code the "Acquire Fast Config" Click procedure as follows:

#define L_LTWAIN_SHOW_USER_INTERFACE 1
oRasterTwain.FastTransferMode = oRasterTwain.BestFastConfig.TransferMode
oRasterTwain.FastFormat = oRasterTwain.BestFastConfig.FileFormat
oRasterTwain.FastBitsPerPixel = oRasterTwain.BestFastConfig.BitsPerPixel
oRasterTwain.FastBufferSize = oRasterTwain.BestFastConfig.BufferSize
oRasterTwain.FastUsePreferredBufferSize = .T.
oRasterTwain.EnableAcquireMultiEvent = .F.

nRet = oRasterTwain.AcquireMulti("c:\temp\test", L_LTWAIN_SHOW_USER_INTERFACE, .T.)

If nRet = 0 Then
   MessageBox("Image acquisition using the Fast TWAIN Configuration is completed.")
Else
   MessageBox("An error occurred while acquiring images using the Fast TWAIN Configuration.")
EndIf

5.

Save your project and run the PRG program to test it.