DTWAIN_StartThread

Top  Previous  Next

The DTWAIN_StartThread function allows an application to call DTWAIN functions in a secondary thread if DTWAIN was initialized in another thread.

 

LONG DTWAIN_StartThread ( LONG DLLHandle );

 

 

Parameters

DLLHandle

The value returned from DTWAIN_SysInitialize or DTWAIN_SysInitializeEx.

 

Return Values

If the function succeeds, a non-zero value is returned.  If the function fails, zero (0) is returned.

 

Comments

 

The DTWAIN_StartThread function should be called at the start of a new thread if calls to DTWAIN will be made in the new thread and DTWAIN was initialized in a different thread.  Initialization of DTWAIN is done by either calling DTWAIN_SysInitialize of DTWAIN_SysInitializeEx.

 

The DLLHandle is the return value that DTWAIN_SysInitialize or DTWAIN_SysInitializeEx returned when DTWAIN was initialized.

 

For example, if DTWAIN_SysInitialize was called in thread 1, and later on, another thread (thread 2) will now make calls to DTWAIN, it is required that the call to DTWAIN_StartThread be made before calling DTWAIN functions in thread 2.  The DLLHandle would be the return value of DTWAIN_SysInitialize that was made in thread 1.

 

Before exiting the thread, a call to DTWAIN_EndThread must be made.

 

For more information on multithreading issues with DTWAIN, please see DTWAIN Multithreading Issues

 

TWAIN State Transitions

State 1

 

Prerequisite Calls

None.

 

Optional Prerequisite Calls

None.

 

See Also

DTWAIN_SysDestroy, DTWAIN_IsTwainAvailable, DTWAIN_IsInitialized