Visual Basic Development

Top  Previous  Next

DTWAIN32 DLL, DTWAIN32U.DLL, DTWAIN64.DLL and DTWAIN64U.DLL are standard 32-bit and 64-bit Windows Dynamic Link Libraries that exposes its functionality using the "stdcall" calling convention.

 

DTWAIN32(U) DLL and DTWAIN64(U).DLL are not Active X controls or servers.  DTWAIN cannot be "registered" with RegSvr.exe or similar programs. The DTWAIN DLL's must be located either in your application's program directory, or in a directory specified by your system's PATH environment variable.  If not, you will not be able to call the DTWAIN functions successfully.

 

If you are using Visual Basic and are not familiar with calling functions located in DLL's, most VB tutorials, books, and the various VB reference manuals usually contain many examples of making calls to various Windows API functions that are located in the Windows system DLLs (such as KERNEL32, USER.EXE and GDI32.DLL).

 

If you are using Visual Basic 6.0 or below, the DTWAIN32.BAS file for 32-bit VB programs found in the \VisualBasic\Bas subdirectory of the installation defines the functions and constants used by the DTWAIN32 library.

 

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 or receive from the DTWAIN DLL functions are of the correct character set type.

 

the DTWAIN32_NET.BAS interface to DTWAIN is found in the \VisualBasic\Net subdirectory of the installation.  In addition, the DTWAIN64_NET.VB is the interface file for 64-bit applications developed in Visual Basic .NET (there are no 64-bit interface files for Visual Basic 6.0 or below).

 

Also included is the WIN32.BAS file that should be used for Windows API calls.  This file is necessary if you want to call GlobalLock or GlobalFree in your VB application.

 

Also, take note that DTWAIN is a generic Windows-type DLL and not an ActiveX control.  Therefore passing VB specific data types to DTWAIN (for example VB strings instead of null-terminated strings) will not work.  The DTWAIN32.BAS file contains the prototypes of the functions and the arguments/return types expected.

 

The Visual Basic examples found in the \Examples\VisualBasic folder contain Visual Basic form (.FRM) files and possibly (.BAS) files that are Visual Basic 6.0 compatible.  To create the sample, you must define a Visual Basic project and include the files in each of the subfolders.  For example, the /NoUI example contains files Form2.frm and Form4.frm.  Create a Visual Basic project, and include the files Form2.frm, Form4.frm, DTWAIN32.BAS, and WIN32.BAS. Compile the project, and the NoUI example will be created.

 

ANSI and Unicode Application Development

Visual Basic Example Programs

Visual Basic / DTWAIN Data Types

Visual Basic and Device Independent Bitmaps

Visual Basic TWAIN Processing

Using DTWAIN Notifications with Visual Basic