A Problem about scanning in backgroundworker

Discussions about TWAIN scanning in GdPicture.NET using GdPictureImaging.
Post Reply
hank1235
Posts: 2
Joined: Tue Jun 14, 2016 10:27 am

A Problem about scanning in backgroundworker

Post by hank1235 » Tue Jun 14, 2016 10:44 am

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

i90270
Posts: 2
Joined: Mon Mar 28, 2016 5:46 am

Re: A Problem about scanning in backgroundworker

Post by i90270 » Fri Jun 17, 2016 9:19 am

I have this issue too , is anybody can reply this issue?

User avatar
Loïc
Site Admin
Posts: 5597
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: A Problem about scanning in backgroundworker

Post by Loïc » Fri Jun 17, 2016 10:25 am

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

Cedric
Posts: 263
Joined: Sun Sep 02, 2012 7:30 pm

Re: A Problem about scanning in backgroundworker

Post by Cedric » Fri Jun 17, 2016 12:36 pm

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.

hank1235
Posts: 2
Joined: Tue Jun 14, 2016 10:27 am

Re: A Problem about scanning in backgroundworker

Post by hank1235 » Mon Jun 20, 2016 1:00 pm

I have post same support case on http://support.gdpicture.com

thank a lot~
Attachments
Twain Scanning - Asynchronous.zip
(84.68 KiB) Downloaded 71 times

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest