The company i work for have been using GdTwain.ocx to scan for many years however i'm rewriting it for a .NET 2.0 application.
I've downloaded the GDPicture.NET trial and i'm currently trying to evaluate if it is worth upgrading from the ActiveX control to the new .NET control. The main reason i'm doing this is quite simply that i want to do my scanning in a multithreaded environment instead of on the UI thread.
For testing purposes, i've converted over the sample that is shipped with GDPicture called twain_sample and simply done the following:
Code: Select all
Private Sub Command1_Click '....
If OpenSelectedSource() Then 'Opens the source just fine.
Dim oThread As New Threading.Thread(AddressOf Start_Threaded)
oThread.Start()
End If
End Sub
Private Sub Start_Threaded()
'Here we will scan in a 1bpp ccitt4 & 200 DPI from adf to multipage tif file
Dim nImageCount As Integer
Dim ImageID As Integer
nImageCount = 0
oGdPictureImaging.TwainSetHideUI(True)
oGdPictureImaging.TwainSetIndicators(False)
oGdPictureImaging.TwainSetAutoFeed(True) 'Set AutoFeed Enabled
oGdPictureImaging.TwainSetAutoScan(True) 'To achieve the maximum scanning rate
oGdPictureImaging.TwainSetResolution(200)
oGdPictureImaging.TwainSetPixelType(TwainPixelType.TWPT_BW) 'Black & White
oGdPictureImaging.TwainSetBitDepth(1) ' 1 bpp
Do
ImageID = oGdPictureImaging.TwainAcquireToGdPictureImage(0) 'Me.Handle)
'ImageID will never get this far for the code to continue.
If ImageID <> 0 Then
End If
Loop While oGdPictureImaging.TwainGetState > TwainStatus.TWAIN_SOURCE_ENABLED
End Sub
I've tried this out of a thread and the code works correctly and scans fine. I'm trying this on an Epson GT15000.
If it isn't possible to scan inside a thread then unfortunately i can't justify upgrading to GdPicture.NET as it is no different to the GDTwain.ocx version we already own
Regards,
Mark G