Page 1 of 1

A Problem about scanning in backgroundworker

Posted: Tue Jun 14, 2016 10:44 am
by hank1235
Hi!
I have a problem about scanning.
if I have set a scanner preference before doing the scan (because i have a lot scanners and need to set a default's between them)
example:
I set my default scanner source name = TestScanner

this is part of my code in below

(

Code: Select all

 Private defaultScannerName as string = "TestScanner"
 Private Sub scanBackgroundWorker_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles scanBackGroundWorker.DoWork

            Dim hwnd As IntPtr = IntPtr.Zero 'To enfore the TWAIN controler to create its own windows proxy in this SAME thread.
            DevExpress.Data.CurrencyDataController.DisableThreadingProblemsDetection = True
            Dim isInvalidStop As Boolean = False
            If GDPictureImagingObj.TwainOpenSource(hwnd,defaultScannerName) Then
               .......
               .......
               .......
            END
)

THEN

GDPictureImagingObj.TwainOpenSource(hwnd,defaultScannerName) return False to me

I can use that code in normal situation , but cannot in backGroundWorker

*Note :
I need to set the default scanner before doing the scan , so i don't use the method about GDPictureImaging.TwainSelectSource()

Thank you for your reply

Re: A Problem about scanning in backgroundworker

Posted: Fri Jun 17, 2016 9:19 am
by i90270
I have this issue too , is anybody can reply this issue?

Re: A Problem about scanning in backgroundworker

Posted: Fri Jun 17, 2016 10:25 am
by Loïc
Hello there,

Please follow this tutorial to fix your issue or to provide us required materials for investigation:

viewtopic.php?t=1486

With best regards,

Loïc

Re: A Problem about scanning in backgroundworker

Posted: Fri Jun 17, 2016 12:36 pm
by Cedric
Hello,

May I add that because TwainOpenSource returns False, you need to use TwainGetLastResultCode and TwainGetLastConditionCode methods to diagnose the error.
The most common error is the device name being wrong but it is impossible to guess what could be the reason of this failure because a lot of different things can happen.

Re: A Problem about scanning in backgroundworker

Posted: Mon Jun 20, 2016 1:00 pm
by hank1235
I have post same support case on https://www.gdpicture.com/support/getting-support-from-our-team

thank a lot~