Home › Forums › TWAIN Classic › How to get twain scanners from twain device list?
- This topic has 3 replies, 2 voices, and was last updated 9 years, 9 months ago by spike.
- AuthorPosts
Hi everybody,
I am using DelphiTwain to activate scanner from my program (Delphi XE4).
The version of DelphiTwain is probably old one due to this comment from code:
…{DELPHI IMPLEMENTATION OF TWAIN INTERFACE}
{december 2003®, initially created by Gustavo Daud}…My task is:
When I am listing Twain devices I get web cameras and scanner devices.
How could I separate web cameras from scanners in two different list?I found only this article that much my question
http://forums.codeguru.com/showthread.p … evice-list
but unfortunately it didn’t answer for my question.Could anyone help me with this issue??
Looking forward for your answer.
Best Regards,
Vasyl.How could I separate web cameras from scanners in two different list?
I found only this article that much my question
http://forums.codeguru.com/showthread.p … evice-list
but unfortunately it didn’t answer for my question.I looked at that thread on codeguru.com, it seems to answer your question exactly.
It says “You can’t do that,” and he’s right.What’s the larger problem that this is part of?
The problem is in the specific of my program.
My client want to split Web-Cameras and Scanners in two different forms.One of this form will work only and only with scanners and there user will be able only scan (using DelphiTwain).
Other form will keep only and only web-cameras and user will be able only record video (using DirectShow).I am wondering if I could look in some properties(compability) of devices that actually supported only by Scanners and not supported by Web Cameras or vice versa. Is it possible?
I am guessing: for example look at device property “device could rotate picture” – and in case when this property set to “True” or some other positive value – it’s mean SCANNER device, otherwise device is Web-Camera.Does it make sence?
Yes… sort of. Here are the main problems:
1. There are no TWAIN properties that are guaranteed to appear only on cameras or only on scanners.
(This question has come up before. Google is your friend.)
2. To get the properties of a device, you have to open the device.
3. When you open a device that is not powered on and connected, the TWAIN driver will display a message to the user.
(No, you can’t prevent this.)
4. Some TWAIN drivers (I’m lookin’ at you, Kofax…) can take up to 10 seconds to open, and almost another 10 seconds to close.What this means is that going through the list of TWAIN devices, and checking the properties of each one, could cause some real problems.
You could reduce these problems by having your program remember whether a device was a scanner or camera, so it would only check the first time a device appeared in the list.The list of cameras in the TWAIN list isn’t the same as the list of DirectShow devices!
Why not use DirectShow to get the list of (DirectShow) sources, and use the TWAIN list as the list of TWAIN devices?- AuthorPosts