scanner hangs when no paper is feeded for NoUI

Issue #40 new
alpha berrie created an issue

I was trying to run the provided NTwainTest (By default, the UI was supressed). If no paper is feeded, then the scanner just doesn't respond for a long time. I just wonder if there is any way to detect the paper is feeded or not before I can start scan.

Comments (3)

  1. Eugene Wang repo owner

    If supported by the driver, you can use Capabilities.CapFeederLoaded.GetCurrent() on the DataSource.

  2. Keith Platter

    I was having this issue as well, and was able to use the CapFeederLoaded and CapPaperDetectable to get around this issue. However I was looking for a way to handle other data source UI components that may open and block the scanning process when the UI is suppressed.
    I was able to hook the window creation messages and get notification of windows being created on the process, but I am unable to close the windows if they remain open because I can not send a destroy message since it is on another thread. Is it safe to just close the Datasource or Session if it remains open/enabled for a length of time (via timer)? Is their an example of using the SynchronizationContext to have the ui on the same thread?

  3. Eugene Wang repo owner

    You should be able to use pass a WindowsFormsMessageLoopHook or WpfMessageLoopHook object when calling TwainSession.Open() to have it run on the UI thread.

  4. Log in to comment