Search code examples
c#wpfimagingimage-scannertwain

C# TWAIN interaction


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.


Solution

  • 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.