ImageGear for C and C++ on Windows v19.0
Open the Source

Before the application performs any scanning operation, the user is offered a list of available scanning devices from which to choose, in the event that there is more than one. IG_TWAIN_source_open() will display the TWAIN Select Source dialog box with a list of available scanning devices, as shown below:

 

 

The call to this function is straightforward:

 
Copy Code
#include <windows.h>

#include "gear.h"
#include "i_TWAIN.h"

bool OpenTheDataSourceManager(HWND hWnd)
{
    AT_ERRCOUNT errorCount = 0;
    bool bIsSourceOpen = false;

    // Select TWAIN device from which to acquire an image.
    errorCount = IG_TWAIN_source_open(hWnd, NULL, TRUE);
    if (errorCount == IGE_SUCCESS)
    {
        bIsSourceOpen = true;
    }
    return bIsSourceOpen;
}       

Call this function before calling any other TWAIN functions.

You can create your own dialog box for Data Source selection by using the DS enumeration API, all of which include "source" in their names. Call IG_TWAIN_source_get_first(), then IG_TWAIN_source_get_next() with a loop to detect all available devices. Use IG_TWAIN_source_open() to open the source selected by the end user. See TWAIN Component API Reference for detailed descriptions on the API. See also TWAIN.c file, included in your Sample directory, for an implementation of a dialog box using these functions.

 

 


©2017. Accusoft Corporation. All Rights Reserved.

Send Feedback