Development Issues
Since DTWAIN operates as a generic Windows 32 or 64 bit Dynamic Link Library (DLL), any Windows environment that allows calls to external DLL's can use DTWAIN. This includes Visual Basic, Delphi, C#, Python, Perl, Java (using JNI), and many others.
Before starting, you must make sure that the DTWAIN DLL file is available either in your application's executable directory, or one of the directories specified on your system PATH. The reason for this is that your program will attempt to issue calls to the DTWAIN DLL, and if the DLL can't be found by the operating system, the call will fail and the program more than likely will terminate with an error.
The DTWAIN DLL file will be either one of the following, depending on your development plans: DTWAIN64.DLL (For 64-bit non-Unicode applications) DTWAIN64U.DLL (For 64-bit Unicode applications)
Please note that 64-bit applications can only communicate with 64-bit TWAIN drivers and devices. Similarly, 32-bit applications can only communicate with 32-bit TWAIN drivers and devices. In addition to the above DLL's, there are text-based resource files that must reside in the same place as the DTWAIN DLLs. The names of the resource files are as follows: twaininfo.txt twainresourcestrings_english.txt The files above are required, since they contain all the information concerning the naming of the TWAIN capabilities, triplet information, etc. You do not need to know what these various aspects of TWAIN are -- just make sure these files reside in the same directory as the dtwain*.dll when your application is executed. An error is displayed if DTWAIN cannot find these files or the files are corrupted and/or cannot be opened.
The topics below contain extra information on programming languages that DTWAIN has been tested with:
For other languages not listed above: Development in Other Languages
For development issues dealing with bitmap and floating point data, and loading/unloading the DTWAIN DLL during runtime: Floating Point Issues and DTWAIN Loading and Unloading the DTWAIN Dynamic Link Library at runtime
Consult the user's manual of your programming environment for information on how to make calls to external DLL's. If you need to set up an interface to the DTWAIN functions and are not sure how to set up the parameters for the DTWAIN functions, the best approach is to see how your environment defines the parameters when calling a Windows API function such as CreateWindow, BitBlt, GetWindowText, etc. Almost all programming documentation for various languages have code samples of calling a Windows API function, so you can use this as a template when interfacing to DTWAIN.
Please note that the DTWAIN documentation assumes you know the computer language you're using fully enough to make correct calls to external DLL functions. For example, if a DTWAIN function requires a string buffer that will be filled in by the DTWAIN function on return, it is assumed that your program written in the computer language you're using has already allocated space for the character buffer before calling the DTWAIN function, or if a function requires a LONG value, you're sending a 32-bit integer and not a string, etc.
Most of the DTWAIN function parameter types match as closely as possible to the usual parameter types that you will see associated with Windows API functions. For example, LPCTSTR, LPVOID, LONG, BOOL, etc. that DTWAIN uses are exactly the same types as used with the Windows API functions.
Here is a small table of how to interpret the various DTWAIN types using the standard 'C' language types:
For 64-bit applications, some of the above definitions will be 64-bit integers and pointers. Here is a table of the differences between the 32-bit definitions and 64-bit definitions:
If your language environment does not support floating point values, please read the section on Floating Point Issues and how to circumvent the limitation on floating point.
|
The files above are required, since they contain all the information concerning the naming of the TWAIN capabilities, triplet information, etc. You do not need to know what these various aspects of TWAIN are -- just make sure these files reside in the same directory as the dtwain*.dll when your application is executed.
If these files are not found, you will receive the following error when running your application;
The files above are required, since they contain all the information concerning the naming of the TWAIN capabilities, triplet information, etc. You do not need to know what these various aspects of TWAIN are -- just make sure these files reside in the same directory as the dtwain*.dll when your application is executed.
If these files are not found, you will receive the following error when running your application;
The files above are required, since they contain all the information concerning the naming of the TWAIN capabilities, triplet information, etc. You do not need to know what these various aspects of TWAIN are -- just make sure these files reside in the same directory as the dtwain*.dll when your application is executed.
If these files are not found, you will receive the following error when running your application;
The files above are required, since they contain all the information concerning the naming of the TWAIN capabilities, triplet information, etc. You do not need to know what these various aspects of TWAIN are -- just make sure these files reside in the same directory as the dtwain*.dll when your application is executed.
If these files are not found, you will receive the following error when running your application;