|
C# Development |
Top Previous Next |
|
Please note: If you are building a 64-bit application, you will be using DTWAIN64.DLL, not DTWAIN32.DLL.
The DTWAIN32.DLL or DTWAIN64.DLL must be installed either in your application's directory, or in a directory that is specified in your system's PATH environment variable.
Included in the DTWAIN installation is a C# interface file DTWAIN32.CS, or if you're building a 64-bit application, DTWAIN64.CS. All you need to do is to add this file in your C# project:
The DTWAIN interface is in the Dynarithmic namespace, and the calls are defined in class TwainAPI.
The following small application shows how to use the C# interface:
namespace WindowsApplication { using Dynarithmic;
static void Main() { int status=0; TwainAPI.DTWAIN_SysInitialize( ); int Source = TwainAPI.DTWAIN_SelectSource( ); TwainAPI.DTWAIN_AcquireFile(Source, "test.bmp", TwainAPI.DTWAIN_BMP, TwainAPI.DTWAIN_USENAME + TwainAPI.DTWAIN_USENATIVE, TwainAPI.DTWAIN_PT_DEFAULT, 1, 1, 1, ref status); TwainAPI.DTWAIN_SysDestroy( ); } }
Note the using clause states that the namespace to use is DynaRithmic, and the class TwainAPI contains the DTWAIN functions and constants.
|