|
C/C++ Sample: Acquire and save to BMP file |
Top Previous Next |
|
The following 'C' / C++ function is all that is required to do the following:
___________________________________________________________________ #include <dtwain.h>
void ExampleFunction( ) { LONG ReturnCode;
/* Check if TWAIN exists. Return if TWAIN is not installed */ if ( DTWAIN_IsTwainAvailable( ) == 0 ) return;
/* Initialize DTWAIN DLL, return if there is a problem */ if ( DTWAIN_SysInitialize( ) == 0 ) return;
/* Select the Twain Source */ ReturnCode = DTWAIN_TwainSave("-f test.bmp");
/* Close down TWAIN, etc. */ }
__________________________________________________________________
The example above is a C or C++ function that demonstrates some of the power of the DTWAIN command line interface using DTWAIN_TwainSave. The only functions that are DTWAIN specific are the following:
DTWAIN_IsTwainAvailable is only optional. DTWAIN will still work correctly in a system that has no TWAIN drivers installed by returning an error if a selection of a TWAIN device is attempted.
The command-line function, DTWAIN_TwainSave takes a single argument that describes what is to be done to acquire an image. A complete list of options are found in the DTWAIN_TwainSave command overview.
|