TwainAcquireToGdPictureImage Hanging

Discussions about TWAIN & WIA scanning in GdPicture.NET using GdPictureImaging.
Locked
Gone2mars
Posts: 3
Joined: Fri Dec 03, 2010 9:11 am

TwainAcquireToGdPictureImage Hanging

Post by Gone2mars » Fri Dec 03, 2010 10:51 am

Hi,
You may have noticed that i've already posted an issue a few minutes earlier regarding Multithreading, As this problem appears to be different i thought i'd make a seperate post for it.

I can run your .NET sample (twain_sample) absolutely fine. Unlike my earlier post there is NO multithreading in place here as i thought i'd continue to develop while i'm waiting for an answer to my earlier post.

In your sample i hit 'Command3_Click', the Scanner is opened successfully (Epson GT15000), the resolution is set and UI is hidden, TwainAcquireToGdPictureImage is then run. This then causes my scanner to start - No problems here.

However, when i move the EXACT same code into my development application (literally cutting and pasting!) then the scanner does not work. When TwainAcquireToGdPictureImage is called it simply blocks and does not return.

You may think that the references are not correct but i've referenced the version of GDPicture.Dll in the GAC that the sample is using and I also know the dll is working as it has produced a log file that shows GDPicture apparently stuck in a loop?

When i close the MDIChild window the dispose event is called on the usercontrol, the .TwainUnloadSourceManager is called. At this point, the TwainAcquireToGdPictureImage method stops blocking and returns an imageID of 0.

The only thing that is different is that i'm running a MDI form with a MDI Child form inside it, this form then houses a usercontrol and then that usercontrol has another usercontrol inside it that provides a scanning interface to the user. I'm not sure if this would make a difference?

I've also tried using different handles (MDI Parent.handle, Usercontrol.handle etc) and also IntPtr.ZERO but nothing makes any difference.




EDIT: I cannot upload my log file as your website keeps saying 'The extension log is not allowed.' I've tried changing it to .dat, .abc but the same error.

Basically the line below keeps looping over:
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0

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

Re: TwainAcquireToGdPictureImage Hanging

Post by Loïc » Fri Dec 03, 2010 12:57 pm

Hi,
The only thing that is different is that i'm running a MDI form with a MDI Child form inside it, this form then houses a usercontrol and then that usercontrol has another usercontrol inside it that provides a scanning interface to the user. I'm not sure if this would make a difference?
It is probably the reason of the hanging. The problem can come from many things...

To investigate your issue we need some other information. Please check this thread (we need everything described in it): viewtopic.php?t=1486
Also, we need a basic application reproducing the problem. When you have everything, just create a support case at https://www.gdpicture.com/support/getting-support-from-our-team & we will review the problem in priority.

Kind regards,

Loïc

Gone2mars
Posts: 3
Joined: Fri Dec 03, 2010 9:11 am

Re: TwainAcquireToGdPictureImage Hanging

Post by Gone2mars » Fri Dec 03, 2010 1:44 pm

Ok ... I've submitted a support ticket.

Thanks for your help

BenV
Posts: 21
Joined: Thu Dec 02, 2010 4:54 pm

Re: TwainAcquireToGdPictureImage Hanging

Post by BenV » Tue Dec 14, 2010 5:12 pm

Hey there

I'm having exactly the same problem however, I'm not using a MDI window.
The application has one form that renders a couple of components such as a toolstrip and some panels. Also a default PDF file is loaded into the Viewer in the form_load event. The program starts fluently. Problems occur when I click the Scan button.

INFO:
- GdPicture.NET Document Imaging SDK Ultimate (32-bit & 64-bit)
- Device: Fujitsu fi-6130, TWAIN Driver: TWAIN version 1.9
- OS: Windows 7 Professional
Sample This is the code that is executed when I press the scan button. It is kept as simple as possible.

Code: Select all

Dim image As Integer
With pictureImaging
       If .TwainOpenSource(Me.Handle, deviceSource) Then
                 .TwainSetHideUI(True) 
                .TwainSetAutoFeed(True) ' Try to enable or disable the Source’s automatic document feeding process.
                .TwainSetAutoScan(True)
                .TwainSetPixelType(TwainPixelType.TWPT_RGB) 'RGB
                .TwainSetBitDepth(8)
                image = .TwainAcquireToGdPictureImage(Me.Handle)

                .TwainCloseSource()
                .TwainLogStop()
                If image <> 0 Then
                    pictureViewer.DisplayFromGdPictureImage(image)
                End If

                pictureViewer.Focus()
            End If
        End With
- Log file contains the same info as the one from Gone2mars
Last edited by BenV on Tue Dec 14, 2010 6:04 pm, edited 1 time in total.

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

Re: TwainAcquireToGdPictureImage Hanging

Post by Loïc » Tue Dec 14, 2010 5:15 pm

Hi,

I just posted a code snippet for asynchronous scanning. See: viewtopic.php?t=2861

If you still have a problem you have to send a standalone application which reproduce the problem at https://www.gdpicture.com/support/getting-support-from-our-team

kind regards,

Loïc

BenV
Posts: 21
Joined: Thu Dec 02, 2010 4:54 pm

Re: TwainAcquireToGdPictureImage Hanging

Post by BenV » Tue Dec 14, 2010 5:56 pm

Thanks for the VERY quick reply Loic.

I copied over your code and this is what I get:

Code: Select all

Cross-thread operation not valid: Control 'ScanTool' accessed from a thread other than the thread it was created on.
I never was a big hero when it comes to multithreading, so I guess I'll start making an account on your support site :) .

BenV
Posts: 21
Joined: Thu Dec 02, 2010 4:54 pm

Re: TwainAcquireToGdPictureImage Hanging

Post by BenV » Mon Dec 20, 2010 2:32 pm

Hey, it's me again. I've managed to get the scanner working with the background worker but only one time. So it scanned only one paper. When I press "scan" again, I get this exception:

Code: Select all

A first chance exception of type 'System.AccessViolationException' occurred in GdPicture.NET.dll
Shutting down both application and printer doesn't work.

[EDIT] I'm using GdPicture 7.3 btw

The message specified by the exception is:

Code: Select all

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

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

Re: TwainAcquireToGdPictureImage Hanging

Post by Loïc » Mon Dec 20, 2010 5:34 pm

Hi,

OK. Please send application reproducing the problem to https://www.gdpicture.com/support/getting-support-from-our-team.

Kind regards,

Loïc

BenV
Posts: 21
Joined: Thu Dec 02, 2010 4:54 pm

Re: TwainAcquireToGdPictureImage Hanging

Post by BenV » Mon Jan 24, 2011 3:24 pm

I was wondering, are you guys still busy fixing this issue? I've opened a ticket on your support site as you asked but it keeps sending me emails saying I didn't reply on suggestions and the ticket will be closed. As you can see in the ticket's conversation history, I did reply, so the site had no reason to close it. I'll open the ticket (8027) once more and hopefully you'll pick it up again.

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

Re: TwainAcquireToGdPictureImage Hanging

Post by Loïc » Mon Jan 24, 2011 3:55 pm

Hii Ben,

We just gave you a reply on this.

Kind regards,

Loïc

payne296
Posts: 22
Joined: Wed Jul 07, 2010 5:25 pm

Re: TwainAcquireToGdPictureImage Hanging

Post by payne296 » Wed Mar 09, 2011 5:34 am

We're you able to resolve this BenV? I've seen the same thing.

yhsalame
Posts: 1
Joined: Thu Feb 21, 2013 1:07 pm

Re: TwainAcquireToGdPictureImage Hanging

Post by yhsalame » Thu Feb 21, 2013 1:09 pm

Hello All,

I'm facing the same problem of "TwainAcquireToGdPictureImage Hanging", Did anybody reach the solution for this problem?

please advice.

Best regards,

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

Re: TwainAcquireToGdPictureImage Hanging

Post by Loïc » Thu Feb 21, 2013 7:38 pm

Please guys understand that almost each TWAIN problem is unique. So stop to reply this thread and follow instructions described here to provide needed info to our staff: viewtopic.php?t=1486

I will lock this topic now.

Thank you for your cooperation.

Loïc

Locked

Who is online

Users browsing this forum: No registered users and 1 guest