Selecting TWAIN Data Source Manager

Top  Previous  Next

The TWAIN Data Source Manager (DSM) is the module that is responsible for routing TWAIN commands from DTWAIN to your manufacturer's TWAIN driver.  This module comes in the form of a Dynamic Link Library.

 

On all 32-bit Windows operating systems, the DSM is TWAIN_32.DLL.  This file is included when you install the Windows operating system.  By default, 32-bit applications developed with DTWAIN will automatically use this DSM to communicate with your 32-bit TWAIN drivers.  You usually find this file in your C:\Windows or C:\Windows\System32 directory, however differing environments (for example, Terminal Server environments) may place TWAIN_32.DLL in specific user directories.

 

For a 64-bit operating system and 64-bit TWAIN drivers, there is no DSM that comes installed for the operating system.  Therefore, you are required to install the DSM yourself when deploying your 64-bit application.  The 64-bit DSM is TWAINDSM.DLL.  Without this file, you cannot communicate with 64-bit TWAIN drivers.  This file can be installed in any directory accessible via the PATH environment variable, or the directory where you application executable is installed.

 

The above describes the default behavior for DTWAIN -- if developing a 32-bit application, the DSM used is TWAIN_32.DLL, and when developing a 64-bit application, the DSM is TWAINDSM.DLL.  Your application doesn't have to select the DSM, as DTWAIN will select the correct DSM depending on the whether the application you've developed is 32 or 64 bit.

 

However, for 32-bit applications, it is possible for your application to use another version of the DSM.  There is a special 32-bit version of TWAINDSM.DLL that you can use.  The advantage in using the specialized 32-bit version of TWAINDSM.DLL is as follows:

 

The TWAINDSM.DLL is open source.  This means you have the full source code to the TWAIN Data Source Manager.  If there is a bug in the DSM, it can be fixed or diagnosed without any licensing issues.  On the other hand, the TWAIN_32.DLL that comes with the Windows operating system has no publicly available source code, meaning you're stuck if there happens to be a bug in the default 32-bit DSM.
 
The TWAINDSM.DLL has implemented the new, alternate means of communicating with TWAIN drivers.  This may not mean a lot for a DTWAIN developer, since the DTWAIN library handles these low-level details, but it does become an advantage for future DTWAIN library versions, when DTWAIN starts to implement more advanced features that are bound to be available for TWAIN drivers in the future.

 

Note that the 64-bit TWAINDSM.DLL has the advantages above, i.e. it is open source, and it has the updated methods of communicating with TWAIN drivers.

 

If you desire to use the 32-bit version of TWAINDSM.DLL, the DTWAIN_SetTwainDSM function allows you to do this.