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 with a '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#, 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 (2.4).  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.


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 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

DTWAIN_IsTwainAvailable
DTWAIN_SysInitialize
DTWAIN_SelectSource
DTWAIN_AcquireFile
DTWAIN_SysDestroy

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.

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.

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.