4

I have to get images from scanner with TWAIN 1.x interface

Some old scanners scan too long time so I guess how to notify user about scanning progress. There is built-in popup window with progress bar and "cancel" button but it's something I want to override.

Instead of TWAIN WIA API sends me pieces of scan with progress percent so I can solve this task with WIA, but what about TWAIN ?

I tried this nice TWAIN demo http://www.codeproject.com/KB/audio-video/twaintest.aspx.

It uses message loop for scanning. I guess that scan progress should be represented as set of messages sent to message loop but I was wrong. There are only some initial and finalization messages.

Is there a way to be notified about scan progress with TWAIN 1.x API?

Thank you in advance!

Andrew Florko
  • 7,672
  • 10
  • 60
  • 107

2 Answers2

3

For future reference...

There is no way to get scan progress through the TWAIN API, and no standard way to get it by 'cheating' either. TWAIN does give you a way to ask the TWAIN driver to display (or not) a progress dialog, as mentioned by the OP, but the dialog box is designed and operated by the individual TWAIN driver.

If you don't like a given driver's progress box, you have few choices:

  • Hack the driver's progress box at run-time (low-level Win32 programming, hook procedures, etc.)
  • Use TWAIN's Memory Transfer Mode (see the TWAIN Spec) - which delivers each image as a sequence of buffers. You can display progress by comparing the total pixels or rows transferred versus the expected total. However, be aware that either the scanner or the driver may scan, post-process the image, and only then transfer the data, putting your progress display pretty seriously out-of-sync.

My advice is to spend your effort on some other aspect of the system, where you have control.

Spike0xff
  • 1,246
  • 1
  • 15
  • 24
0

You can get image scan progress if you acquire image from scanner using Memory transfer mode. Native and File transfer modes do not allow to get image scan progress. Progress step depends from TWAIN driver.

alexangr
  • 1
  • 2