Delphi Development

Top  Previous  Next

Please note:  Late breaking news as of the writing of this manual is Delphi now supports 64-bit applications.   For 64-bit applications, DTWAIN64.DLL is used, as well as DTWAIN64.PAS is used as the interface file instead of DTWAIN32.PAS.  In the information below, any reference to DTWAIN32.DLL and DTWAIN32.PAS pertains to DTWAIN64.DLL and DTWAIN64.PAS, respectively.

 

DTWAIN32 DLL is a standard 32-bit Windows Dynamic Link that exposes its functionality using the "stdcall" calling convention.   Currently DTWAIN is not a true Delphi component, but only a Dynamic Link Library.  Included in the DTWAIN installation is a Delphi interface file DTWAIN32.PAS.  All you need to do is include this file in your Delphi application, and in the uses clause in the interface section, specify DTWAIN32.

 

Since DTWAIN has 64-bit types, the DTWAIN32.PAS file is compatible with Delphi 4 and above.  Earlier versions of Delphi did not have 64-bit integer types, therefore if you're using an earlier version of Delphi, you will need to use the DTWAIN32_PRE4.PAS file.

 

The DTWAIN32.DLL must be installed either in your application's directory, or in a directory that is specified in your system's PATH environment variable.

 

There are example Delphi programs that demonstrate how to use DTWAIN.  The programs are very simple, and are meant to illustrate how to get started with various aspects of TWAIN.  All of the demo programs should compile with Delphi 4 or higher.  The only demo program that will not compile for Delphi 3 and below is CAPINFO, as this demo uses features of Delphi that exist only in version 4 and above.

 

Delphi supports callback functions, so you can monitor the progress of a TWAIN acquisition using notifications using Delphi.

 

As of this writing of the manual, only an ANSI version of the Delphi interface file is available.  This means that DTWAIN32.DLL and DTWAIN64.DLL will work correctly for Delphi applications, therefore it is recommended that you to use DTWAIN32.DLL or DTWAIN64.DLL.

 

If you wish to use the Unicode version of DTWAIN (DTWAIN32U.DLL or DTWAIN64U.DLL), you will need to change the definitions in the *.PAS files to ensure that the strings are passed and received correctly from the Unicode DTWAIN functions to your Delphi program.