Twain acquisition

Discussions about TWAIN & WIA scanning in GdPicture.NET using GdPictureImaging.
Post Reply
eagleman
Posts: 27
Joined: Mon Jan 25, 2010 1:48 pm

Twain acquisition

Post by eagleman » Thu Feb 04, 2010 2:39 pm

I wrote 3 functions with the following functionality:

Function1 opens the default source: oImaging.TwainOpenDefaultSource(this.Handle);

Function2 executes oImaging.TwainAcquireToGdPictureImage(this.Handle); in a loop until a 0 is returned (no paper anymore in the scanner)

Function 3 closes the twain source: oImaging.TwainCloseSource();

These are very simple functions.

After function1 is called, I call function2 to scan the paper in the scanner. When all is scanned, I put more paper in the scanner and
call function2 again. Now nothing happens. TwainAcquireToGdPictureImage always returns 0. Only if function1 is called again, function2 works.

Why?

Please advise.

I am running GdPicture version 6,6001

Eagleman

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

Re: Twain acquisition

Post by Loïc » Thu Feb 04, 2010 5:35 pm

Hi,

We are already investigating on this kind of problem since few days.

I think you can fix quickly your problem using TwainUnloadSourceManager instead of TwainCloseSource.

If your problem persists, please give us the needed information to help you. See: viewtopic.php?t=1486


With best regards,

Loïc

eagleman
Posts: 27
Joined: Mon Jan 25, 2010 1:48 pm

Re: Twain acquisition

Post by eagleman » Thu Feb 04, 2010 5:46 pm

Loïc,

There is no problem with TwainCloseSource.

The problem is that after scanning all paper from the scanner, I cannot scan again. I have to call TwainOpenDefaultSource before i can scan again.

eagleman

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

Re: Twain acquisition

Post by Loïc » Thu Feb 04, 2010 5:50 pm

Hi,
The problem is that after scanning all paper from the scanner, I cannot scan again
Some scanners need to be closed after a scan process. it is probably your case.

In all case if you want more investigation from our side, please follow the steps explained here: viewtopic.php?t=1486

Kind regards,

Loïc

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

Re: Twain acquisition

Post by Loïc » Thu Feb 04, 2010 5:55 pm

Another hint: Call TwainSetAutoSourceClose(False) before your scan process.


Loïc

eagleman
Posts: 27
Joined: Mon Jan 25, 2010 1:48 pm

Re: Twain acquisition

Post by eagleman » Fri Feb 05, 2010 10:18 am

Loïc,

TwainSetAutoSourceClose(false) did the trick. Now it works as expected.

However, shouldn't the AutoSourceClose be false by default?

It is logical to think that a scanning process looks like:

OpenSource
Scan..(some papers)
Scan..(some more papers)
Scan..
Scan..
Scan..
CloseSource

Nevertheless, thanks for taking the time to find a solution to our problems.

eagleman

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

Re: Twain acquisition

Post by Loïc » Fri Feb 05, 2010 11:09 am

Hi,
However, shouldn't the AutoSourceClose be false by default?
It is the question ! :mrgreen:

We set it to True by default because some scanner doesn't support to stay in open state after a scan process.

Kind regards,

Loïc

eagleman
Posts: 27
Joined: Mon Jan 25, 2010 1:48 pm

Re: Twain acquisition

Post by eagleman » Fri Feb 05, 2010 5:23 pm

You are right: that is THE question.

Thanks for your help.

eagleman

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests