DTWAIN_SetDSMSearchOrder

Top  Previous  Next

The DTWAIN_SetDSMSearchOrder function sets the directories that are searched whenever DTWAIN attempts to locate and load the TWAIN Data Source Manager.

 

DTWAIN_BOOL DTWAIN_SetDSMSearchOrder ( LONG SearchOrder );

 

 

Parameters

 

SearchOrder

A LONG value denoting the order of directory searching when attempting to locate and load the TWAIN Data Source Manager.

 

 

Return Values

The return value is TRUE if successful.  Otherwise FALSE is returned.

 

Comments

The DTWAIN_SetDSMSearchOrder function allows the application to set the order of the directories searched when attempting to locate and load the TWAIN Data Source Manager (DSM) File.  This file is usually TWAIN_32.DLL or TWAINDSM.DLL, depending on whether the application is 32-bit or 64-bit.

 

The functions that use the DSM search order set by DTWAIN_SetDSMSearchOrder are DTWAIN_IsTwainAvailable, DTWAIN_GetDSMFullName, and DTWAIN_StartTwainSession.

 

The SearchOrder specifies which set of directories to search and the order of searching the directories.   The following values are available to SearchOrder.

 

SearchOrder constant name

Value

Directory and Search Order

DTWAIN_TWAINDSMSEARCH_WSO

0

WINDOWS, SYSTEM, OS search

DTWAIN_TWAINDSMSEARCH_WOS

1

WINDOWS, OS search, SYSTEM

DTWAIN_TWAINDSMSEARCH_SWO

2

SYSTEM, WINDOWS, OS search

DTWAIN_TWAINDSMSEARCH_SOW

3

SYSTEM, OS search, WINDOWS

DTWAIN_TWAINDSMSEARCH_OWS

4

OS search, WINDOWS, SYSTEM

DTWAIN_TWAINDSMSEARCH_OSW

5

OS search, SYSTEM, WINDOWS

DTWAIN_TWAINDSMSEARCH_W

6

WINDOWS only

DTWAIN_TWAINDSMSEARCH_S

7

SYSTEM only

DTWAIN_TWAINDSMSEARCH_O

8

OS search only

DTWAIN_TWAINDSMSEARCH_WS

9

WINDOWS, SYSTEM

DTWAIN_TWAINDSMSEARCH_WO

10

WINDOWS, OS search

DTWAIN_TWAINDSMSEARCH_SW

11

SYSTEM, WINDOWS

DTWAIN_TWAINDSMSEARCH_SO

12

SYSTEM, OS search

DTWAIN_TWAINDSMSEARCH_OW

13

OS search, WINDOWS

DTWAIN_TWAINDSMSEARCH_OS

14

OS search, SYSTEM

 

The WINDOWS and SYSTEM denote the WINDOWS and SYSTEM directories, as specified by the GetWindowsDirectory and GetSystemDirectory Windows API functions, respectively.  The OS search uses the search path logic that the Windows Operating System uses to search for DLL files.  See Locating and Loading the TWAIN DSM for more information on the WINDOWS, SYSTEM, and OS searches.

 

The DTWAIN_SetDSMSearchOrder function can be called before calling DTWAIN_SysInitialize, and before calling DTWAIN_IsTwainAvailable.  The DTWAIN_IsTwainAvailable function will use the current search order set by DTWAIN_SetDSMSearchOrder to check if TWAIN is available on the user's system.

 

If multiple directories are to be searched, the first directory found that contains the TWAIN DSM will be used.  For example, DTWAIN_TWAINDSMSEARCH_WSO will search the WINDOWS directory first, and if the TWAIN DSM can be found in the WINDOWS directory, the search stops successfully (as it is not necessary to search SYSTEM and the OS for the DSM file).

 

By default, if DTWAIN_SetDSMSearchOrder is never called by the application, the search order used by DTWAIN to locate and load the DSM is DTWAIN_TWAINDSMSEARCH_WSO.

 

Please note:

Previous versions of DTWAIN prior to Version 4.2,used the DTWAIN_TWAINDSMSEARCH_O search order.   DTWAIN 4.2 and above now sets the default search option to DTWAIN_TWAINDSMSEARCH_WSO. Therefore if you are using DTWAIN 4.2 or above, and want to use the same DSM search order as versions prior to 4.2, your application must call

 

DTWAIN_SetDSMSearchOrder( DTWAIN_TWAINDSMSEARCH_O )

or

DTWAIN_SetDSMSearchOrder( 8 )

 

prior to any other DTWAIN function calls.

 

 

TWAIN State Transitions

None.

 

Prerequisite Function Call(s)

None.