Home › Forums › TWAIN Classic › Problem with TwainDotNetProject and CanoScan Lide 110
- This topic has 1 reply, 2 voices, and was last updated 11 years, 5 months ago by MarkM.
- AuthorPosts
Hello,
My question may be stupid or irrelevant because I am a newcomer to TWAIN, so please forgive me for that.I am using the TwainDotNet project (http://code.google.com/p/twaindotnet/) for WPF and with all the scanners I tried it works fine, except one: Canoscan Lide 110. In it’s case the application stucks on the “warming up” splash screen.
Trough some debug I discovered that the application goes into an infinite loop because in this code block:
TwainResult result = Twain32Native.DsEvent(
ApplicationId,
DataSource.SourceId,
DataGroup.Control,
DataArgumentType.Event,
Message.ProcessEvent,
ref _eventMessage);if (result == TwainResult.NotDSEvent)
{
handled = false;
return IntPtr.Zero;
}the “result” variable always gets “NotDSEvent”.
Have no idea how to solve this, so any help will be highly appreciated.
From a defensive programming standpoint, the safest way to access the scanner is from a process that separate from your main application. That way if the scanner process hangs or crashes, it doesn’t take out the application. That doesn’t solve the problem, though, it just makes it easier to recover.
TwainResult.NotDSEvent is part of the TWAIN protocol. When an application asks a data source to begin scanning or bring up its GUI, then it’s supposed to redirect all Windows messages to the driver, so that the driver’s GUI has first crack at any messages. Just moving the mouse around your application should be enough to generate that response from the driver.
Essentially, TwainResult.NotDSEvent is the TWAIN driver saying “that Windows message doesn’t belong to me, so you can have it back.”
Make sure that you only use one thread to access the TWAIN driver (the same thread that opened the driver). Also, try moving the mouse over the splash screen to see if that makes a difference. I don’t recommend accessing a TWAIN driver from your main application thread, create a thread that’s dedicated to communicating with the scanner.
Finally, contact Canon and/or the Twain Dot Net forum for more help…
- AuthorPosts