C # TWAIN interoperability

I am trying to configure a C # application that uses a TWAIN example from a code project

This works fine, except that I need to drop Form in IMessageFilter and call IMessageFilter.PreFilterMessage() to catch the TWAIN callbacks.
I also need to start this filtering by calling

 Application.AddMessageFilter(); 

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

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

Thanks.

+6
c # wpf imaging twain image-scanner
source share
3 answers

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

+4
source share

I just wrapped the code from an article by Thomas Scheidegger ( CodeProject: Scanning .NET TWAIN Images ) in a github project

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

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

+6
source share

I thought TWAIN was considered deprecated. Perhaps look at the WIA that does this work with WinXP. There is also a sample in the code project. As for the question related to WPF, I don’t know, I used it only in Windows form applications.

+1
source share

All Articles