ANSI and Unicode Application Development

Top  Previous  Next

For Visual Basic .NET and above (including VB 2005, 2008, 2010, etc.):

 

If you are using Visual Basic .NET or Visual Basic 2005/2008/2010, it is highly recommended to use the Unicode version of the DTWAIN libraries, DTWAIN32U.DLL and DTWAIN64U.DLL.  The reason is that these languages use .NET, and .NET uses Unicode strings by default.  By using the Unicode versions of the DTWAIN library, it will ensure that strings that you pass to or receive from the DTWAIN DLL functions are of the correct character set type.

 

 

Please note for Visual Studio users:

 

By default, Visual Studio assumes that your VB applications are Unicode enabled.  This means that all new Visual Studio projects use DTWAIN32U.DLL or DTWAIN64U.DLL, depending on whether the application will be a 32-bit application or 64-bit application.   To use the Unicode versions of DTWAIN, you must use the DTWAIN32U_NET.VB or DTWAIN64U_NET.VB interface files in your VB project, so that all string related DTWAIN functions are called correctly without issues.  Otherwise, your application may crash or experience erratic behavior.

 

If you have developed a VB.NET/2005/2006/2010 application using DTWAIN prior to version DTWAIN 4.x and wish to continue developing your application using DTWAIN 4.x or above, it is highly recommended to use the Unicode version of DTWAIN DLL's, plus use the DTWAIN32U_NET.VB or DTWAIN64U_NET.VB interface files.

 

 

For Visual Basic 6.0 and below

 

It is highly recommended you use only the ANSI version of the DTWAIN DLL's, DTWAIN32.DLL and DTWAIN64.DLL, in addition using the ANSI version of the interface files (DTWAIN32.BAS, DTWAIN64.BAS).  Even though the DTWAIN DLL would be ANSI-based, you can still call the Unicode specific DTWAIN functions directly (for example, DTWAIN_GetErrorStringW) if you have a need to process Unicode strings.