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 | |
---|---|
// Select TWAIN device from which to acquire an image nErrCount = IG_TWAIN_source_open(hMainWnd, NULL, TRUE); if (nErrCount == IGE_SUCCESS) bIsSourceOpen = TRUE; |
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.