DTWAIN_OpenSource

Top  Previous  Next

The DTWAIN_OpenSource function opens a selected Source

 

DTWAIN_BOOL DTWAIN_OpenSource ( DTWAIN_SOURCE Source );

 

 

Parameters

Source

Specifies a selected TWAIN Source.

 

Return Values

If the function succeeds, TRUE is returned.  If the function fails FALSE is returned.

 

Comments

The DTWAIN_OpenSource function opens the DTWAIN_SOURCE Source.  When the Source is opened, the application can negotiate any capability that the Source can support, plus other functionality that requires an open Source.  The Source provided must have been previously selected by one of the DTWAIN Source Selection Functions.

 

By default, an application doesn't have to call DTWAIN_OpenSource, since selecting a Source using DTWAIN_SelectSource, DTWAIN_SelectSourceByName, and DTWAIN_SelectDefaultSource will automatically open the Source.  However, there are scenarios where the application must call DTWAIN_OpenSource explicitly:

 

If DTWAIN_OpenSourcesOnSelect was called with a FALSE argument, then the application must explicitly call DTWAIN_OpenSource to open the Source.

If DTWAIN_SelectSource2() was used with the DTWAIN_DLG_NOOPENONSELECT flag being set.

If DTWAIN_SelectSourceWithOpen() or DTWAIN_SelectSourceByNameWithOpen was called with the "open" parameter being set to FALSE.

If the application called DTWAIN_CloseSource, the application must called DTWAIN_OpenSource to reopen the Source.

 

The only case where the application never has to call DTWAIN_OpenSource is the case where once the Source is selected, the next operation is to acquire an image.  

 

There is no harm in repeatedly calling DTWAIN_OpenSource on a Source that is already opened.  DTWAIN internally checks for Sources that are already opened, and will not attempt to reopen a Source that is already opened.

 

TWAIN State Transitions

State 4

 

Prerequisite Function Call(s)

DTWAIN_SysInitialize

 

DTWAIN Source Selection Function

 

See Also

Opening / Closing a Source