DTWAIN_CallDSMProc |
Top Previous Next |
The DTWAIN_CallDSMProc allows an application to call the TWAIN Data Source Manager (DSM) directly
#include <twain.h> LONG DTWAIN_CallDSMProc (
Parameters AppID The DTWAIN_IDENTITY for the application
SourceId The DTWAIN_IDENTITY for the Data Source
lDG Data Group of Twain Triplet
lDAT Data of TWAIN Triplet
lMSG Message of Twain Triplet
pData Extra data required by Twain Triplet
Return Values The TWAIN return code. Consult the TWAIN 1.8 specification for return codes when the DSM is called.
Comments The DTWAIN_CallDSMProc is a low-level DTWAIN function that allows an application to call the TWAIN Data Source Manager (DSM) directly. When an application calls the DSM, the application must specify the TW_IDENTITY of the application and the source, a TWAIN triplet, and extra data. The application and Source ID can be obtained by calling DTWAIN_GetTwainAppID and DTWAIN_GetSourceID, respectively.
The Twain triplet is divided into three arguments. The triplet consists of a DG, DAT, and MSG value all denoted by the lDG, lDAT, and lMSG parameters, respectively.
The pData parameter represents a pointer to extra data that the triplet needs to perform the Twain function. This value depends on the DG, DAT, and MSG parameters. Consult the Twain specification to see what value is placed here.
All ID, triplet, and extra info is described in the current TWAIN 1.8 documentation, available at http://www.twain.org. For example, to set the gray scale response curves of a Data Source, the following call can be executed:
#include <dtwain.h> #include <twain.h> /* Needed for TW_GRAYRESPONSE definition and DG_IMAGE, DAT_GRAYRESPONSE, and MSG_SET.*/
TW_GRAYRESPONSE G; DTWAIN_SOURCE Source; /*...*/ DTWAIN_SysInitialize(); DTWAIN_StartTwainSession(NULL,NULL); Source = DTWAIN_SelectSource( ); /*...*/ LONG RetVal = DTWAIN_CallDSMProc(DTWAIN_GetTwainAppID(), DTWAIN_GetSourceID(Source), DG_IMAGE, DAT_GRAYRESPONSE, MSG_SET, &G);
Note that you need to include TWAIN.H for the definitions described above. Note that you still need to use the DTWAIN_SysIntialize functions before using this function.
The DTWAIN_CallDSMProc should be used by experienced C or C++ TWAIN programmers who need to call the TWAIN DSM directly. If you have little to no experience with calling functions directly to the TWAIN DSM, call this function at your own risk. If a call to the DSM results in a change of TWAIN states, DTWAIN does not know internally that the state has changed. Please be aware of this when calling DTWAIN_CallDSMProc.
TWAIN State Transitions Depends on arguments to DTWAIN_CallDSMProc
Prerequisite Function Call(s) DTWAIN_GetTwainAppID (if AppID is not NULL) DTWAIN_GetSourceID (if SourceID is not NULL)
See Also |