Home › Forums › TWAIN Classic › C++, Windows, How to get TWAIN device list?
- This topic has 3 replies, 3 voices, and was last updated 10 years, 8 months ago by Kaij.
- AuthorPosts
Hi,
Is there a way to get the TWAIN device list that exist on Windows without the need to use 3rd part component?
Maybe some Windows API or something like that…
I am using Visual Studio 2010 and C++ (Not C#)
Thanks in advance…If you don’t want to use a 3rd party component, you can code based on TWAIN specification yourself.
These resources might help:
http://www.codeproject.com/Articles/296/A-C-Wrapper-for-TWAIN
http://sourceforge.net/projects/twain-samples/
http://twain.org/scannerdriverdevelopers/specification-and-tools.htmlHTH
Catherine Sea
http://www.dynamsoft.comAll these posts seems to lead to tools or wrappers isn’t there is a reference API list or something like that build in the Windows API or MFC?
Sure. It is easy to do without tools in C++.
Just use the TWAIN API and look in the specification 2.2. for MSG_GETFIRST and MSG_GETNEXT as for examble.1. Use the DG_CONTROL / DAT_IDENTITY / MSG_GETFIRST operation to have the Source
Manager locate the first Source available. The name of the Source is contained in the
TW_IDENTITY.ProductName field. Save the TW_IDENTITY structure.
2. Use the DG_CONTROL / DAT_IDENTITY / MSG_GETNEXT to have the Source Manager
locate the next Source. Repeatedly use this operation until it returns TWRC_ENDOFLIST
indicating no more Sources are available. Save the TW_IDENTITY structure.
3. Use the ProductName information to display the choices to the user. Once they have
made their selection, use the saved TW_IDENTITY structure and the DG_CONTROL /
DAT_IDENTITY / MSG_OPENDS operation to have the Source Manager open the desired
Source. (Note, using this approach, as opposed to the MSG_USERSELECT operation,
the Source Manager does not update the system default Source information to reflect your
choice.)
4. Use the DG_CONTROL / DAT_IDENTITY / MSG_SET to set the system default source.I hope that answers your question.
Best regards,
KaijOEM TWAIN drivers and toolkits from http://www.jse.de
- AuthorPosts