There are multiple ways and libraries available for Consuming TWAIN data source in C# window application but my requirement is to make my application TWAIN ready which will be used as TWAIN data source for calling application.
1 Answers
Please check the TWAIN Specification for more details. It can be downloaded from http://www.twain.org/
The Source
The Source receives operations either from the application, via the Source Manager, or directly from the Source Manager. It processes the request and returns the appropriate Return Code (the codes are prefixed with TWRC_) indicating the results of the operation to the Source Manager. If the originator of the operation was the application, then the Return Code is passed back to the application as the return value of its DSM_Entry( ) function call. If the operation was unsuccessful, a Condition Code (the codes are prefixed with TWCC_) containing more specific information is set by the Source. Although the Condition Code is set, it is not automatically passed back. The application must invoke an operation to inquire about the contents of the Condition Code.
The implementation of the Source is the same as the implementation of the Source Manager:
On Windows - The Source is a Dynamic Link Library (DLL) with a .ds extension.
DS_Entry is only called by the Source Manager. Written in C code form, the declaration looks like this:
TW_UINT16 TW_CALLINGSTYLE DS_Entry
( pTW_IDENTITY pOrigin, // source of message
TW_UINT32 DG, // data group ID: DG_xxxx
TW_UINT16 DAT, // data argument type: DAT_xxxx
TW_UINT16 MSG, // message ID: MSG_xxxx
TW_MEMREF pData // pointer to data
);

- 380
- 2
- 9
-
Thanks! I have not much knowledge about c++, can you please guide me with some steps to creating dll with .ds extension. – Sanjay Gupta Dec 06 '17 at 05:05
-
This is actually quite complex. I suggest you outsource this part to a TWAIN expert company. – flysakura Dec 06 '17 at 07:18