EZTwain Pro User Guide
Datasource Manager (AKA DSM)
The common TWAIN module distributed by the TWAIN Working Group. This module,
often called the DSM, is maintained by the members of the Working Group, and is
provided in binary form to all TWAIN developers. It is customary for TWAIN devices
to install/update the DSM when they install their individual TWAIN Sources and low-
The job of the DSM is to act as a go-between, coordinating and passing information
between TWAIN applications and TWAIN Sources. Many users and developers
assume that ‘TWAIN’ (meaning the DSM) does some kind of serious processing or
translation during scanning. This is not true. The DSM’s jobs are simple:
1. Find and enumerate the installed Sources, display the Select Source dialog on
request, and remember which DS is currently the default.
2. When an application issues an OPEN request, connect it with a Source.
3. Pass TWAIN operation requests from the application to the open DS, and pass
notifications back to the application from the DS.
All user interface, image processing, error handling, etc. etc. is divided between the
application and the DS.
Default Datasource AKA Default TWAIN Device
To avoid applications asking users ‘From which device?’ every time they want to
acquire an image, TWAIN defines a default device.
If there is only one TWAIN device installed in the system, then - that’s it. Otherwise,
it is the last TWAIN device selected by the user in the Select Source dialog. Which is
the only bit of user interface provided by TWAIN itself, so to speak – it is displayed
by the TWAIN Source Manager.
Scanning jargon meaning ‘to straighten up’. If you have done much scanning, you
have probably noticed that some documents are scanned at a slight angle, This is
called skew in the imaging industry. Some scanners, and many image software
packages including EZTwain, can straighten out or deskew such tilted scans.
DIB (Device Independent Bitmap)
An image format defined and used by Windows – EZTwain stores images in memory
as DIBs. A DIB consists of a header giving height, width, bits per pixel, resolution,
and so forth, followed by a color table if needed, followed by the pixels of the image.
As an added complexity, the convention in Windows is to store DIBs in global
memory blocks and work with the handles of these blocks – which are not pointers.
You will frequently see images referenced by objects of type HANDLE, or HGLOBAL or
As a consequence, to access the information in a DIB you must either lock the DIB
handle to obtain a pointer, or call one of EZTwain’s many DIB functions (which lock
and unlock the handle internally.)