TWAIN:如何获取图像扫描进度?

发布于 2024-11-25 07:58:13 字数 472 浏览 1 评论 0原文

我必须使用 TWAIN 1.x 接口从扫描仪获取图像

一些旧扫描仪扫描时间太长,所以我想如何通知用户扫描进度。 有内置的弹出窗口,带有进度栏和“取消”按钮,但我想覆盖它。

WIA API 不是向我发送带有进度百分比的扫描片段,而是向我发送带有进度百分比的扫描片段,这样我就可以使用 WIA 来解决此任务,但是 TWAIN 呢?

我尝试了这个不错的 TWAIN 演示 http://www.codeproject.com/KB/audio -video/twaintest.aspx

它使用消息循环进行扫描。我想扫描进度应该表示为发送到消息循环的消息集,但我错了。只有一些初始和最终消息。

有没有办法通过 TWAIN 1.x API 通知扫描进度?

先感谢您!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

凌乱心跳 2024-12-02 07:58:13

供将来参考...

无法通过 TWAIN API 获取扫描进度,也没有标准方法通过“作弊”获取扫描进度。正如 OP 所提到的,TWAIN 确实为您提供了一种要求 TWAIN 驱动程序显示(或不显示)进度对话框的方法,但该对话框是由单独的 TWAIN 驱动程序设计和操作的。

如果您不喜欢给定的驱动程序的进度框,则没有什么选择:

  • 在运行时破解驱动程序的进度框(低级 Win32 编程、挂钩过程等)
  • 使用 TWAIN 的内存传输模式(请参阅 TWAIN Spec) - 将每个图像作为一系列缓冲区提供。您可以通过比较传输的总像素或行数与预期总数来显示进度。但是,请注意,扫描仪或驱动程序可能会扫描、对图像进行后处理,然后才传输数据,从而使进度显示严重不同步。

我的建议是将精力花在系统的其他一些您可以控制的方面。

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.

羁客 2024-12-02 07:58:13

如果使用内存传输模式从扫描仪获取图像,您可以获得图像扫描进度。本机和文件传输模式不允许获取图像扫描进度。进度步骤取决于 TWAIN 驱动程序。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文