Development Issues |
Top Previous Next |
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, FoxPro, C#, Perl, Access, Java (using JNI), and many others. If you are already familiar with how to use third-party DLL's within your application, you can skip this topic.
Note for Visual Basic programmers: DTWAIN DLL is not an ActiveX DLL. The following topics discuss the various programming environments and the interface to DTWAIN.
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.
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.
|