DTWAIN_SetCustomDSData
The DTWAIN_SetCustomDSData sets the custom data of a Source.
HANDLE DTWAIN_SetCustomDSData (
Parameters: Source An open TWAIN Source.
hData Specifies the global handle to the data, or NULL
pData Specifies the address of where the Source data is located or NULL.
nSize Specifies the number of bytes to copy from pData. If pData is NULL, this argument is ignored.
nFlags Flags to determine how to interpret the hData and pData arguments.
Returns: TRUE if successful, otherwise FALSE is returned.
Comments: DTWAIN_SetCustomDSData uses the DAT_CUSTOMDSDATA TWAIN Data type to set the Source's custom data. The Source must support setting of custom data. To test if the Source supports custom data, call DTWAIN_IsCustomDSDataSupported. Usually mid to high-volume scanners support this type of operation.
Note: The format of the data sent to the Source is Source dependent and is not defined by TWAIN, therefore your application must have knowledge of the format of the data from the creator of the Source. Usually the manufacturer of the device has specifications as to what format the data is to send and how to interpret the data..
If the value of nFlags is DTWAINSCD_USEHANDLE, the hData argument is the HANDLE to Globally Locked memory that contains the Source data. The handle must be created with the Windows API GlobalAlloc function. The pData and nSize arguments are ignored if DTWAINSCD_USEHANDLE is specified.
If nFlags is DTWAINSCD_USEDATA, the hData argument is ignored, and the Source data is located at pData. The length of the data located at pData is specified by the nSize argument. If the application does not desire to do the memory management, this method should be used.
Setting the Source's custom data is usually done after the application calls the DTWAIN_ShowUIOnly and then DTWAIN_GetCustomDSData.
TWAIN State Transitions The Source must be in State 4 or higher
Prerequisite Function Call(s)
DTWAIN Source Selection Function
See Also |