DTWAIN_SysInitialize

Top  Previous  Next

The DTWAIN_SysInitialize function initializes the DTWAIN DLL for use with the application.

 

LONG DTWAIN_SysInitialize( );

 

Parameters

None.

 

Return Values

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

 

Comments

 

The DTWAIN_SysInitialize function must be called before attempting to call most of the other DTWAIN DLL functions.  This function is responsible for initializing various structures and variables within the DTWAIN DLL.  If DTWAIN_SysInitialize is called, a subsequent DTWAIN_SysDestroy must also be called.

 

The best place to call DTWAIN_SysInitialize is on application startup, with DTWAIN_SysDestroy called on application shutdown.  Although app startup and shutdown are the safest place to call these functions, your application will still work successfully if you desire to place all of the DTWAIN code within a function block or procedure.  In the latter case, the first function would be DTWAIN_SysInitialize followed by other DTWAIN functions, and the last function would be DTWAIN_SysDestroy.

 

If DTWAIN_SysInitialize is called again without an intervening DTWAIN_SysDestroy, the LONG value returned from the first call to DTWAIN_SysInitialize is returned.

 

Note:

The return value of DTWAIN_SysInitialize is a handle to the DTWAIN library API, and is associated with the identifier of the thread that is currently running when DTWAIN_SysInitialize is called.  All subsequent DTWAIN API calls will check the current thread ID against this handle.  If the current thread id is not associated with the handle, the DTWAIN function will return a -1001 error (DTWAIN not initialized).  This means that the thread that calls DTWAIN_SysInitialize must be the same thread where all other DTWAIN functions will be called from.

 

TWAIN State Transitions

State 1

 

Prerequisite Calls

None.

 

Optional Prerequisite Calls

None.

 

See Also

DTWAIN_SysDestroy, DTWAIN_IsTwainAvailable, DTWAIN_IsInitialized