DTWAIN Quick Start

Top  Previous  Next

The easiest way to start using DTWAIN is to do just a few of the DTWAIN functions, and see how the application behaves.

 

Right away, you can start with the easiest sample program, and that is to acquire a single page to a BMP file from your TWAIN device.

 

The most elementary sequence is the following:

 

Check if TWAIN is installed (DTWAIN_IsTwainAvailable)
Initialize the DTWAIN DLL Interface
Select a TWAIN Source
Acquire An Image
Retrieve the generated Images
Shutdown the DTWAIN DLL

 

The first item involves calling DTWAIN_IsTwainAvailable.  This function will let you know right away if the proper TWAIN DLL's are installed on the system.  If the system does have TWAIN installed, your application would proceed with the rest of the sequence desribed above.

 

For a more advanced DTWAIN application, the following can be done:

 

Check if TWAIN is installed (DTWAIN_IsTwainAvailable)
Initialize the DTWAIN DLL Interface
Choosing the TWAIN Loop Model
Start a TWAIN Session
Select a TWAIN Source
Open the TWAIN Source
Set / Get Device Capabilities
Acquire Image(s)
Process DTWAIN Notifications and Messages
End Acquire and Retrieve the generated Images
End Acquisition Processing
Shutdown the DTWAIN DLL

 

The following is a full code example of most of these steps:

Example

 

For other advanced programming options such as automatic document feeder control, duplex scanning, job control, etc.  the Advanced Programming section will demonstrate these features of DTWAIN.

 

If you want to use a very simple command-line type interface, the DTWAIN_TwainSave function call may be what you are seeking.  With this one function, the entire selection of the initialization of TWAIN, opening the TWAIN Source, acquiring images, and saving these images to files, is done.