Visual Basic Example Programs |
Top Previous Next |
The Visual Basic examples found in the \Examples\VisualBasic folder contain Visual Basic form (.FRM) files and possibly (.BAS) files that are compatible with VB 6.0 and below.
To create the sample, you must define a Visual Basic project (a basic EXE application) 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.
For Visual Basic .NET or Visual Basic 2005/2008/2010, the following code snippet shows how to use the DTWAIN interface.
DTWAINAPI.DTWAIN_SysInitialize() ' Initialize DTWAIN
Dim Source As Integer Dim Status As Integer Source = DTWAINAPI.DTWAIN_SelectSource() 'Select a source
' Acquire to a file called c:\temp.bmp DTWAINAPI.DTWAIN_AcquireFile(Source, "c:\temp.bmp", DTWAINAPI.DTWAIN_BMP, DTWAINAPI.DTWAIN_USENATIVE + DTWAINAPI.DTWAIN_USENAME, DTWAINAPI.DTWAIN_PT_DEFAULT, DTWAINAPI.DTWAIN_ACQUIREALL, 1, 1, Status) DTWAINAPI.DTWAIN_SysDestroy() ' Shut down DTWAIN
The code example uses the functions in the DTWAINAPI class. The example above initializes DTWAIN, selects and opens a Source, and acquires a page to a file called "c:\temp.bmp".
The DTWAINAPI is the VB.NET class interface for DTWAIN. All of the functions and constants in the DTWAINAPI class match the names used in DTWAIN. Therefore, usage of DTWAIN is fully explained in this manual without special attention to Visual Basic NET.
Note: For Visual Basic, including .NET/2005/2008/2010 and later, the constants True and False should never be used in place of the DTWAIN TRUE and FALSE constants. For DTWAIN, TRUE is 1, FALSE is 0. If you are calling a DTWAIN function that requires TRUE or FALSE as an argument, you must state 1 or 0, respectively.
|