Home › Forums › TWAIN Classic › TWAIN interface hanging while clicking on scan
- This topic has 1 reply, 2 voices, and was last updated 11 years, 1 month ago by MarkM.
- AuthorPosts
I am getting the list of scanner installed and I can select the scanner and the scan window appears (twain driver window). In the scan window I can preview the document and change the settings.But when I click SCAN button .. the application hangs..
what am I doing wrong..Do I need to do any coding for the scan button..
which twain method I have to call .. as well as any parameters to be passed…I’m assuming this is on some version of Windows…
Your scanning application should be waiting for a DG_CONTROL / DAT_NULL / MSG_XFERREADY message. This is sent from the TWAIN driver to the Data Source Manager (DSM), which forwards it on to the application.
The application retrieves the event either through calls to DG_CONTROL / DAT_EVENT / MSG_PROCESSEVENT (old style – TWAIN_32.DLL or TWAINDSM.DLL), or through a callback function registered using DG_CONTROL / DAT_CALLBACK / MSG_REGISTER_CALLBACK (TWAINDSM.DLL only).
TWAIN_32.DLL is an old DSM that comes with every version of Windows since Windows 98. TWAINDSM.DLL is an open source project maintained by the TWAIN Working Group. Any TWAIN driver or application can used the supplied .msi file referenced through twain.org to install this version of the DSM.
If your application is using TWAIN_32.DLL with the MSG_PROCESSEVENT method, then the following conditions need to be followed for successful receipt of MSG_XFERREADY…
– the window handle supplied to MSG_OPENDSM and MSG_ENABLEDS much match the window event loop monitoring for MSG_XFERREADY…
– all TWAIN commands should original from the same thread that issued MSG_OPENDSM, and this should be the same thread that creates the window handle described in the previous statement…
The callback mechanism is less restrictive in that a window handle isn’t needed for receipt of MSG_XFERREADY, though it’s still true that all TWAIN commands should originate in the same thread…
Hope that helps…
- AuthorPosts