DTWAIN_GetDSMFullName

Top  Previous  Next

The DTWAIN_GetDSMFullName gets the full path name of the TWAIN Data Source Manager file that will be or is currently being used by DTWAIN to communicate to the TWAIN system.

 

LONG DTWAIN_GetDSMFullName (

LONG

DSMType,

LPTSTR

szBuffer,

LONG

Maxlen,

LPLONG

pWhichPath );

 

Parameters

DSMType

Specifies the DSM manager, either DTWAIN_TWAINDSM_LEGACY or DTWAIN_TWAINDSM_VERSION2.

 

szBuffer

Specifies the address of the character buffer to store the DSM path name.  This parameter can also be NULL.

 

MaxLen

Specifies the maximum number of characters to copy to szBuffer.

 

pWhichPath

Address of a LONG that on return, will be filled in with a constant denoting which directory search found the TWAIN DSM.  This parameter can also be NULL to denote no constant will be returned.

 

Return Values

If the function succeeds, the number of characters copied to szBuffer is returned.  If the function fails, DTWAIN_FAILURE1 is returned.

 

Character specific version

ANSI version:

DTWAIN_GetDSMFullNameA

Unicode version:

DTWAIN_GetDSMFullNameW

 

 

Comments

The DTWAIN_GetDSMFullName function fills szBuffer with the TWAIN Data Source Manager name that will be used by DTWAIN.

 

The DSMType denotes the TWAIN DSM to search for.  The values for DSMType are as follows:

 

DSMType constant value

Value

Definition

DTWAIN_TWAINDSM_LEGACY

1

TWAIN_32.DLL

DTWAIN_TWAINDSM_VERSION2

2

TWAINDSM.DLL (either 32-bit or 64-bit DSM)

 

 

If szBuffer is NULL, the length of the DSM file path, plus 1 for the trailing NULL, is returned.  The MaxLen argument is ignored and no characters are copied to szBuffer. You can use this method to determine the total number of characters needed to store the entire name.

 

The pWhichSearch is a pointer to a LONG variable that on return, if not NULL, will be filled in with one of the following values:

 

Returned constant

Value

Definition

DTWAIN_TWAINDSMSEARCH_NOTFOUND

-1

DSM was not found.

DTWAIN_TWAINDSMSEARCH_W

6

DSM was found in the WINDOWS directory.

DTWAIN_TWAINDSMSEARCH_S

7

DSM was found in the SYSTEM directory.

DTWAIN_TWAINDSMSEARCH_O

8

DSM was found using the Windows search OS search path logic.

 

The table above denotes how the DSM was found.   The value returned denotes either

 

1) The system's WINDOWS directory,

2) the system's SYSTEM directory,

3) or by using the Windows OS search logic to find the DSM.

 

Please see Locating and Loading the TWAIN DSM for more information on the WINDOWS, SYSTEM, and OS search logic used to locate the TWAIN DSM.

 

 

Additional Notes:

The DTWAIN_GetDSMFullName can be called before calling DTWAIN_SysInitialize.  This function also is affected by the DTWAIN_SetDSMSearchOrder function, as DTWAIN_GetDSMFullName uses the search order specified by DTWAIN_SetDSMSearchOrder.

 

TWAIN State Transitions

None.

 

Prerequisite Function Call(s)

None.