ANSI/MBCS and Unicode Applications
In previous versions of DTWAIN, the DTWAIN DLL was 8-bit character based, since the TWAIN protocol is 8-bit character based. In the current version, we now offer both an 8-bit character version of the DTWAIN DLL and a 16-bit (Unicode) character version of the DTWAIN DLL. If you are targeting Unicode (16-bit character) applications, then you should use either DTWAIN32U.DLL or DTWAIN64U.DLL, depending on whether your application is 32-bit or 64-bit, respectively.
If you are targeting MultiByte Character Set (MBCS) or ANSI applications (both 8-bit character sets), then you should use either DTWAIN32.DLL or DTWAIN64.DLL, also depending on whether your application is 32-bit or 64-bit, respectively.
If you have used DTWAIN in a previous version prior to DTWAIN 4.0 the MBCS/ANSI DTWAIN32.DLL or DTWAIN64.DLL in the current version should be used to maintain your existing DTWAIN applications. If you wish to now build Unicode-aware applications, then you should use DTWAIN32U.DLL or DTWAIN64U.DLL.
For users of Visual C++ and Visual Studio 200x and 2010: When creating your C++ project, the default application setting is the Unicode character set. Therefore DTWAIN32U or DTWAIN64U.DLL can be used without adjusting your project settings.
Unicode and ANSI DTWAIN string functions
In addition, there are now DTWAIN API functions that have names that end with the letter W or A, which denote "wide" or Unicode and "A" to mean ANSI (for example DTWAIN_GetErrorStringW, DTWAIN_GetErrorStringA).
These functions are basically ANSI and Unicode specific versions of the DTWAIN functions that handle strings (for example DTWAIN_GetErrorString).
It is highly suggested to not call the "W" or "A" versions of these functions directly. Only when you deem it necessary and safe should you call the DTWAIN string-related functions that are Wide or ANSI specific. For example, if you know that your application is Unicode based, and in some specific part of your application, you must use an ANSI string, then you can call the "A" version of the function, given that the string parameter being passed to DTWAIN is an ANSI string.
.NET languages
If your application is based on the .NET framework, and the language being used to interface to DTWAIN is .NET based, calling a DTWAIN string-related function may result in the .NET's Common Language Runtime (CLR) rules of searching for "A" and "W" functions to be invoked. This CLR rule will automatically find the "W" or "A" version of the DTWAIN function to call, even if your application calls the "normal" DTWAIN function. Since DTWAIN contains "A" and "W" functions internally, the invocation of the CLR lookup rules for string functions is compatible with the DTWAIN library.
From this point, any mention of DTWAIN32.DLL and DTWAIN64.DLL in this documentation also apply to DTWAIN32U.DLL and DTWAIN64U.DLL, unless duly noted. |