当用户取消时 TWAIN 会阻塞
我在扫描应用程序中使用稍微修改过的 Twain Dot Net 版本。问题是,当用户使用扫描仪上的按钮取消扫描(或者卡纸)时,TWAIN 应显示一条错误消息并返回一些故障代码。
但相反,对 DG_IMAGE
/ DAT_IMAGENATIVEXFER
/ MSG_GET
的调用正确返回 TWRC_XFERDONE
,但之后调用 DG_CONTROL
/ DAT_PENDINGXFERS
/ MSG_ENDXFER
永远不会返回。我做错了什么?
该应用程序是使用 WPF 编写的,TWAIN 的消息被发送到在其自己的线程上运行的仅消息窗口。扫描仪是松下KV-S4065C。
I'm using a slightly modified version of Twain Dot Net in my scanning application. The problem is, when the user cancels scanning using a button on the scanner (or if paper jams), TWAIN should show an error message and return with some failure code.
But instead, what happens is that the call to DG_IMAGE
/ DAT_IMAGENATIVEXFER
/ MSG_GET
returns correctly with TWRC_XFERDONE
, but the call to DG_CONTROL
/ DAT_PENDINGXFERS
/ MSG_ENDXFER
right after that never returns. What am I doing wrong?
The application is written using WPF, TWAIN's messages are sent to a message-only window running on its own thread. The scanner is Panasonic KV-S4065C.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经修好了。我不太确定发生了什么,但是在同一个消息循环上运行所有 TWAIN 方法 TWAIN 设置为使用它。这也意味着分割图像传输循环——一次迭代完成后,它会将自己放入消息循环中。
I have fixed it. I'm not exactly sure what's going on, but running all TWAIN methods on the same message loop TWAIN is set up to use did it. That also meant splitting the image transfer loop – after one iteration finishes, it enqueues itself on the message loop.