FlatBed Scanning (Canon Unit 101)
Hello!
I have a flatbed scanner (Canon Unit 101), with installed driver, but I can not find it in the source list (_twain does not contain source named like that). Just for onformation, before NTwain I tried to use TwainDotNet, and that found the source, and can scan from it. Is there anything I can do for get that source?
Thanks for Your work, and thanks for the help! Dynadelm
Comments (9)
-
repo owner -
reporter The program builds for "Any CPU" by default, I changed it to 32-bit but still the same. It gets 3 sources, but can not see the 4th (the flatbed one). The another program is in AnyCPU too.
-
repo owner Can't say why, seems to be a really special scanner. If you haven't tried, does it show in the list when you call the built-in selector (and not through my enumerated sources)? If the built-in list doesn't show then there's not much I can do either.
session.ShowSourceSelector();
-
reporter Hello!
I tried to use what You advised, but nothing happens, when I call that method. The session has 4 owned sources, but none of them is what I need, and the window won't appear (source selector). The only thing I can think of, that the source somehow not work as a twain source, but as a wia. Can I somehow get the wia sources too?
I don't know if this helps, but heres a code snippet from the other code: Twain32Native.DsmIdentity( applicationId, IntPtr.Zero, DataGroup.Control, DataArgumentType.Identity, Message.UserSelect, defaultSourceId);
-
reporter A little update: now the Source selector window pops up, but I cannot find the flatbed unit.
-
repo owner If the twain dsm itself (the dialog) doesn't see it then there's not much I can do either. If the other code can see it on the same machine/config then perhaps you can verify how they're initialized (same bitness, similar app identity properties when opening session). Post the code if possible.
-
reporter I just checked the values, I didn't restart the program, just called the 2 methods.
NTwain: ID: 1 ProtocolMajor: 2 ProtocolMinor: 3 WindowHandle: 1185110 SupportedGroups: 805306371
TwainDotNet: ID: 3225 ProtocolMajor: 1 ProtocolMinor: 9 WindowHandle: 1446918 SupportedGroups: 3
Below You can find the method for getting the sources, from TwainDotNet
public static List<DataSource> GetAllSources(Identity applicationId, IWindowsMessageHook messageHook) { var sources = new List<DataSource>(); Identity id = new Identity(); // Get the first source var result = Twain32Native.DsmIdentity( applicationId, IntPtr.Zero, DataGroup.Control, DataArgumentType.Identity, Message.GetFirst, id); if (result == TwainResult.EndOfList) { return sources; } else if (result != TwainResult.Success) { throw new TwainException("Error getting first source.", result); } else { sources.Add(new DataSource(applicationId, id, messageHook)); } while (true) { // Get the next source result = Twain32Native.DsmIdentity( applicationId, IntPtr.Zero, DataGroup.Control, DataArgumentType.Identity, Message.GetNext, id); if (result == TwainResult.EndOfList) { break; } else if (result != TwainResult.Success) { throw new TwainException("Error enumerating sources.", result); } sources.Add(new DataSource(applicationId, id, messageHook)); } return sources; }
-
repo owner No effective difference in DataGroup, try matching the protocol version to 1.9.
-
reporter Hello!
I tried with 1.9, but still nothing. I'm working on it a while, and I can get the source now, but can not open. The trail I'm following is that the ID was wrong in the Session. I don't know yet what's the right ID. I'm initing NTwain with the ID I got from TwainDotNet, and then I get the sources right. I think it's something with the messageloops, and for some reason, the program needs the main form's handle, or something. I have now problems with opening the source..
Update: Sorry, I wrote it wrong. I can see, and can Open the source, but can not "Enable" it, so I can't start scanning.
- Log in to comment
Check if the process needs to be in 32/64bit.