开发者

TWAIN blocks when user cancels

I'm using a slightly modified version of Twain Dot Net in my scanning applica开发者_高级运维tion. 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜