DTWAIN Frequently Asked Questions

What is the DynaRithmic TWAIN Library (DTWAIN)?
DTWAIN is a programmer's library that allows you (the programmer) to write programs that communicate to TWAIN-compliant devices such as scanners and digital cameras.  The DTWAIN library is implemented as a Windows Dynamic Link Library (DTWAIN32.DLL) with 'C' compatible exported functions.  This allows any computer language that can call exported DLL functions to use DTWAIN, including C, C++, Visual Basic, Visual C#, FoxPro, Delphi, etc.

DTWAIN makes it easier for your application to communicate with your TWAIN-compliant application using the TWAIN API.  DTWAIN is compatible with the latest TWAIN standard (1.9).  For more information on TWAIN, please go to the TWAIN Information Page.

Can you give me a list of the TWAIN devices that has been tested with DTWAIN?
Before giving a list, please remember that DTWAIN is designed to work with any TWAIN compliant scanner, digital camera, webcam, or other TWAIN device.  Since there are literally hundreds of different TWAIN devices, we cannot personally test each one.  However, if the device follows the TWAIN specification, DTWAIN will control the device using the TWAIN protocol. 

If this were not the case (DTWAIN cannot control the TWAIN device), then no third-party application could control the device correctly through the TWAIN protocol, since DTWAIN relies on using the TWAIN protocol to control the device.  Therefore it is in the best interest of the manufacturer to make sure that libraries such as DTWAIN work correctly with their devices.

The list of TWAIN devices we have personally tested include the following (this is not an exhaustive list):

Hewlett-Packard scanners
Fujitsu scanners (simplex and duplex models)
Canon LIDE and CanoScan series of scanners
UMAX scanners
Logitech scanners
Epson scanners
Kodak scanners
Mustek scanners
Microtek scanners
Ricoh scanners
CFM Twain drivers for SCSI-based scanners

IBM Webcam
Sony cameras
Kodak camera

We also have hundreds of other customers running flawlessly with TWAIN devices that we personally have not tested ourselves.  Therefore you can be assured that if your device is TWAIN compliant, DTWAIN will work with it.

Will DTWAIN allow me to write my own TWAIN driver?
The goal of DTWAIN is to make it easier for you to write programs that communicate with devices that already have a TWAIN driver.  DTWAIN is not designed for actually writing TWAIN drivers.

Where should the DTWAIN32.DLL reside on my system when I run my programs?
The DTWAIN32.DLL must reside in

1) A directory that is listed in your system PATH environment variable, or
2) In a directory where your program will find DTWAIN32.DLL.  Some programming environments have a "runtime" directory, where the program will find DLL's and other files that the program needs to operate correctly.

For a more detailed discussion, this following MSDN link describes how Windows searches for DLL files.

I have a scanner that only has an ISIS driver.  Will DTWAIN work with it?
ISIS (Image and Scanner Interface Specification) is another scanner API developed by Pixel Translations (now EMC Captiva), much different than TWAIN.  Since ISIS is a totally different scanner API, it is not supported by the DTWAIN library.

I would like to use DTWAIN, but my programming language is one not listed as a supported language.    Can I still use DTWAIN?
If you are using a programming language that allows you to make calls to functions within DLL's, then your programming language can use DTWAIN.  DTWAIN's functions follow the "stdcall" convention that most programming languages require, and the parameters that are passed to DTWAIN functions are generic to the Windows operating system (32-bit LONG integers,  null-terminated strings, etc.).  

Basically, DTWAIN has made sure that the DLL functions can be called by any programming language by providing the most generic, Windows API-like interface.  No special VBString types, or C++ std::strings or anything like that are used a parameters to the DTWAIN functions, thereby making sure that your programming language can use the DTWAIN DLL.

Given this, practically every programming language that is used to develop Windows programs will allow you to make calls to DLL functions.  The question really is "Using my programming language, how do I declare a function that resides in a DLL?".  This question is difficult to answer, specifically for the reason that each language has their own way of defining functions that reside in DLL's. 

Usually, the information to do this is found in your programming language user's manual, or maybe websites dedicated to the programming language that you're using.  Searching for "calling DLL functions" will yield the correct information for your programming language.  We have created the correct interfaces for Visual Basic (both 6.0 and .NET), C#, Delphi, FoxPro, and C/C++ (using the traditional header files that C and C++ uses).

I'm using Visual Basic 6.0.  Do I need to run regsrvr.exe on the DTWAIN32.DLL to use it in Visual Basic?
No.  DTWAIN32.DLL is not an ActiveX DLL.  It is an ordinary Windows Dynamic Link Library, similar to the DLL's that reside in your Windows\system32 directory or similar directory.  Given DTWAIN32.DLL is a regular DLL, Visual Basic programs must define the exported functions to use the DLL properly.   These definitions are found in the DTWAIN32.BAS file, in which you add DTWAIN32.BAS to your VB projects.

Are .NET or ActiveX component versions of DTWAIN available?
We personally do not create ActiveX controls or .NET components, however our associates at
THBComponents have successfully created ActiveX/.NET control that uses DTWAIN internally called THBTwain.  Please contact THBComponents for more information on availability. 

What licenses do I need if I want to distribute my DTWAIN programs?
If you do not plan to distribute your DTWAIN applications, and are only using DTWAIN for personal use, you just need to purchase a Developer License for each developer working on your application. 

If you plan to distribute your application on a company-wide basis, you will need to purchase a Company Distribution License in addition to Developer's License(s).

If you plan to distribute your application to the general public, i.e. shareware, commercial, or freeware, you must purchase a General Distribution License in addition to Developer's License(s).

If you plan to use DTWAIN in another programmer toolkit library, where your customers will need to make calls directly or indirectly to the DTWAIN functions themselves, you will need to contact sales@dynarithmic.com and discuss purchasing a Toolkit Distribution License.

For more information, please see the Licensing FAQ.

If I purchase a distribution license, do I need to pay extra royalties for distributing my applications?
Once a Company or General License is purchased, you can distribute any amount of DTWAIN applications royalty-free.  Unlike many other libraries, the ability to distribute as many applications as desired without paying extra royalties is very cost-effective.  For a Toolkit License, royalty fees may apply depending on how the applications will be distributed.

I've upgraded to a newer version of the DTWAIN32.DLL to fix a known issue with an older version of DTWAIN32.DLL, however my program still doesn't work correctly.  What do I do now? 
Make sure that you have replaced the DTWAIN32.DLL that you were previously using with the later version.  Many times, a programmer may have multiple versions of DTWAIN32.DLL installed on their system, and when the program runs, it is using the older version.  Remove any old version of DTWAIN32.DLL with the latest version. 

If you have verified that you're running the latest version, but the problem persists, please follow the directions here.

How do I determine what version of DTWAIN I have installed?
There are several ways to determine the current version of DTWAIN.

1) To determine the version of DTWAIN that will be used when running a program, use the getversion.exe program found in the BIN subdirectory of the DTWAIN installation.  This program will determine the version of DTWAIN that will be used when you run your program.

Ideally, you would want to copy the getversion.exe program to where you will run your program, to see what version getversion.exe will detect.  If you have multiple versions of DTWAIN installed on your system, getversion.exe will give the information of the version that will be used by your running program.

2) Call DTWAIN_GetVersionEx from your program.  This function will return to your program the major version, minor version, whether DTWAIN is licensed or not, and the patch level.

3) You can use a DLL tool such as Dependency Walker or DumpBin to get the version number.  DTWAIN versions are numbered as this:

So for example, version means that the version is 2.3 with patch level 03.

4) Creating a log file (see DTWAIN_SetTwainLog), will create a file that will contain the current DTWAIN version that is being used (the DTWAIN version will be listed near the beginning of the file).

How should I report errors to the DynaRithmic support team?

Please use the support page and submit problems there.   If the problem deals with a program you've written, please provide log traces of the program (see DTWAIN_SetTwainLog function for full details).  Support is usually provided within 24 hours of receipt of the problem.

I want to write a program that does (a lot of things with the scanner), but I have no experience with using DTWAIN.  What's the easiest thing to do to start writing DTWAIN programs?
Please look at the sample programs that are installed in the Examples subdirectory.  The simplest program would be to check if TWAIN is installed, initialize DTWAIN, select a device, acquire an image to a file, and shutdown DTWAIN.  Basically, this series of function calls


Please refer to the DTWAIN help file for further information on return values and parameters for these functions.  Once these functions operate correctly, then you can start to experiment with the other aspects of setting your scanner's capabilities, and other more advanced features.

I have a scanner, and DTWAIN doesn't seem to work with it.  What can be the problem?
1) Make sure that DTWAIN will operate your scanner to some extent correctly by running the TestBed applications in the TestBed subdirectory of your DTWAIN installation.  The DTWDEMO.EXE program is the most extensive of these applications.

2) As to your own program, check the return values from the DTWAIN functions.  If there is an error that DTWAIN has detected, the function will return FALSE, NULL or some other value denoting that the function has failed.   If a failure has occurred, the DTWAIN_GetLastError will return the exact error that caused the issue.  Note that all DTWAIN functions that return an error do so for a reason, and that can be discovered by calling DTWAIN_GetLastError.

3) If there is no error that DTWAIN has detected, and the TestBed applications seem to work with your scanner, but there still is a problem, generate a TWAIN log (see DTWAIN_SetTwainLog).  The TWAIN log will collect all calls made to DTWAIN, and calls made to the TWAIN system by DTWAIN.  You can either examine the log file yourself (which isn't difficult once you get the hang of it), or you can submit it as a problem report to support@dynarithmic.com

My scanner is TWAIN compliant,  I am scanning without the scanner's user interface shown.  My DTWAIN program seems to not work correctly when the user interface is not shown, but the program works correctly if I show the user interface to the scanner.  What is the issue here?
Acquiring without showing the scanner's user interface requires your program to make sure that all of the settings required by the TWAIN driver are set with your DTWAIN program.  Remember that the user will not be making selections using the user interface, so your program has to set everything the TWAIN driver needs appropriately by calling DTWAIN functions to set the capabilities, pixel type, color type, number of pages, etc.  before the scanning occurs.

Having stated this, there are a few TWAIN drivers that do not operate correctly when the user interface is not shown due to bugs in the TWAIN driver.   The probable reason for bugs appearing is that the driver was meant to be used with the user-interface being shown, and more than likely was originally designed to work only in this mode.  The mode where the user interface is not shown was probably not tested as thoroughly by the manufacturer.

The best you can do is identify these TWAIN Sources, and report these limitations to us at support@dynarithmic.com.

I want to write a program that does not show the scanner's user interface.  However, the user interface is always shown when my program acquires images from the scanner, even if I request that it not be shown.  What is the problem?
Many TWAIN drivers do not allow operation without a user interface.  Most of these TWAIN drivers are usually for digital cameras.  Requesting to acquire images without a user interface is just that -- a request.  A TWAIN driver does not have to honor the request of turning off the user interface, and will instead show the user interface.

The DTWAIN function DTWAIN_IsUIControllable will return TRUE if the user interface can be switched off.  Your application should call this function before assuming that the user interface can be turned off.

I  am communicating with a TWAIN compliant digital camera, and I'm trying to get the camera to take a picture using DTWAIN.  However, I can't seem to get this to work -- all that is done is that DTWAIN downloads the images already stored in the camera.  Is there a way DTWAIN can make my camera take pictures?
For most, if not all digital cameras, "acquiring" an image means to take the images already stored in the camera, and return a JPEG, Windows BMP, or similar image to the application.   However, there are provisions within the TWAIN specification for a digital camera to take a picture.  The issues with this is that very few digital cameras follow the TWAIN specification in terms of taking automatic pictures.  Instead, many digital camera manufacturers have produced their own software development kits (SDK), independent of TWAIN.  Examples are Kodak and Canon digital cameras.

You should first investigate whether there is an SDK available for your camera.  If so, it is suggested you use the SDK that was developed specifically for the camera you're using.  If your camera is one of the few that does support taking pictures using TWAIN, then there are functions to automatically capture an image.  But please note -- your camera's TWAIN driver must have the capabilities to do this, otherwise using DTWAIN will not work for you (and neither will any other TWAIN package or software). 

The bundled software that comes with my scanner allows the scanner to (do some advanced functionality), but DTWAIN cannot seem to duplicate what the bundled software can do.  What can be the problem?
Many times, the software that comes with the scanner is either not based on TWAIN, or it was written specifically for the scanner that it is bundled with.  In other words, the software doesn't follow the TWAIN protocol fully, and third-party libraries and applications find it very difficult, if not impossible, to get the scanner to work correctly due to the TWAIN driver not adhering to the TWAIN standard.