C# TWAIN interaction

感情迁移 提交于 2019-11-27 06:13:13

问题


I'm trying to set up a C# application which uses TWAIN example from code project

This works fine except that I need to cast Form to IMessageFilter and call IMessageFilter.PreFilterMessage() to catch TWAIN callbacks.
Also I need to start this filtering by calling

Application.AddMessageFilter();

Is there a way to do same thing in WPF Window? (To add message filter and catch TWAIN callbacks).

Another totally high level question: Does anybody know about alternative C# TWAIN libraries\wrappers?

Thank you.


回答1:


You could try it with the ComponentDispatcher.ThreadFilterMessage event.
As far as I understand, it serves the same purpose in WPF as Application.AddMessageFilter() in WinForms.




回答2:


I've just wrapped up the code from Thomas Scheidegger's article (CodeProject: .NET TWAIN image scanning) into github project

I've cleaned up the API a bit and added WPF support, so check it out. :)

It has a simple WPF application that shows how the message filtering works with WPF.




回答3:


I thought TWAIN is considered obsolete. Maybe take a look at WIA, that does this job since WinXP. There is also a sample at codeproject. About the WPF related question, no idea, I only used it in windows forms apps.



来源:https://stackoverflow.com/questions/476084/c-sharp-twain-interaction

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!