Special attention is required if running DTWAIN in a multithreaded application, and usage of DTWAIN will be used in more than one thread.
•
|
When acquiring an image, the DTWAIN function call to Acquire (DTWAIN_AcquireNative, DTWAIN_AcquireFile, etc.) must occur in the same thread where the TWAIN session was started. A TWAIN session is started automatically either by explicitly calling DTWAIN_StartTwainSession, or when a Source is selected. The reason for this is that when acquiring images, TWAIN requires a window handle to route messages. The window handle must be created in the same thread as the TWAIN session.
|
•
|
Many TWAIN drivers/Sources do not operate correctly if they are selected and opened in more than one thread.
|
Given these restrictions, DTWAIN can handle multiple threaded usage under most circumstances.
DTWAIN Handles and Threading Issues
Multiple DTWAIN Sessions
Single DTWAIN Session
|