NTwain not cooperating with TSScan
I greatly appreciate the service you have provided. I only had one issue with NTwain, and that was handled in Issue #14 about the MessageLoopHook.
However, I am facing a new issue that I am having trouble isolating.
When connected to a remote server, I am attempting to use a scanner connected to my local machine using TSScan. If I run your WPF Test Application on that remote server, with either scanner I have attached to my machine (Fujitsu fi-5120c and Brother MFC-8480DN), the scanning progress bar gets to the end, and then the application crashes with a TwainStateException. I have found that the State goes up to 5 on the display and then never comes back down.
I was attempting to debug the issue myself but was unsuccessful. Other sample applications (C# and VB6) work just fine with TSScan and I would like to continue to use NTwain.
Thanks in advance, Brian
Comments (11)
-
repo owner -
repo owner - changed status to resolved
Fixed with workaround from 41d821a
-
Hello,
I am a colleague of Brian's also using a remote server and TSScan. With the latest update the scanning progress bar gets to the end and closes but then it freezes. Clicking anywhere results in "This action cannot be completed because the other application is busy. Choose 'Switch To' to activate the busy application and correct the problem." Do you have an idea about what may be causing this and how to resolve?
Thanks, Nick
-
repo owner - changed status to open
It may help isolate the issue by not using the built-in message loop hook.
Depending on the app type try passing either WpfMessageLoopHook or WindowsFormsMessageLoopHook on the TwainSession's Open() method and see if it works.
-
We've found that if it is a Windows 7 machine it will work fine as it is but Windows Server 2012 produces the issue.
Thanks, Nick
-
Another thing to add. Windows 7 machine was 32 bit and Server 2012 - 64bit OS. App is VB6 application which calls .NET via COM. When we use NTwain from pure .NET application under Server 2012 - it works fine.
So the problem is - NTwain + Server 2012 64 bit + VB6 32bit process
-
We're able to reproduce this consistently on Windows Server 2012 R2 when Desktop Experience is enabled. When it is disabled the scanner works as expected.
-
Hi Eugene,
We have an update. After some remote debugging, we found that in mentioned combination WindowsHook.WndProc is not getting called at all after TwainSession.EnableSource is called (and thus transfer has started). From pure .NET application - we receive XferReady event. Any ideas what could block delivery of XferReady message?
Thanks, Anton.
-
repo owner Sorry I don't really know much about vb6. Wonder if it make a difference if you pass a different hwnd in EnableSource. Or maybe it needs a DoEvents call (or its equivalent) somewhere.
-
Solved by installing TwainDsm.dll 2.3.0 (from Twain.org) on the server. With this version registration of Callback2 succeeds in EnableSource and instead of sending XferReady to WndProc it just calls that callback.
-
repo owner - changed status to resolved
Great
- Log in to comment
The exception is just a sanity check that can usually be ignored by turning EnforceState = false on the TwainSession. This may help with isolating where this is happening or even have it working.
When I get a chance I may test with TSScan myself.