Example 2: Application Information |
Top Previous Next |
Example: Starting DTWAIN with our custom information (this information may be displayed by some Twain driver's user interface in one capacity or another).
#include "cdtwain.h" using namespace DTWAIN;
int main( ) { DTwainAppInfo Info; Info.SetManufacturer("My Company"); Info.SetProductName( "My Product");
DTwainInterface TI(Info); // Initialize the DTWAIN interface, passing in our application information
// Start an acquisition DTwainAcquirer( DTwainSource::SelectDefault( ) ).Acquire("DTWAIN.BMP" ); // selects the default Source and acquires to file DTWAIN.BMP }
Alternative version using function chaining:
#include "cdtwain.h" using namespace DTWAIN;
int main( ) { // Initialize DTWAIN using the application information DTwainInterface TI( DTwainAppInfo( ). SetManufacturer("My Company"). SetProductName("My Product") );
// Start an acquisition DTwainAcquirer( DTwainSource::SelectDefault( ) ).Acquire( "DTWAIN.BMP" ); // selects the default Source and acquires to file DTWAIN.BMP }
Note that the SetManufacturer and SetProductName member functions of DTwainAppInfo return references to the current object. This allows your program to chain the commands together. |