I'm trying to programmatically control a twain scanner within my custom application. I don't want to show the scanner's native UI.
I set CAP_INDICATORS
capability to FALSE
, and set CAP_UICONTROLLABLE
capability to TRUE
.
Then I start the scan using DG_CONTROL / DAT_USERINTERFACE / MSG_ENABLEDS
, while ShowUI
in TW_USERINTERFACE
structure is set to FALSE
.
I tested through different scanners. While my Epson DS-30 scanner is working as expected without ui, my Avision A6 scanner still shows a progress UI during scan:
This UI appears when I call DG_IMAGE / DAT_IMAGEINFO / MSG_GET
operation, to get the image details from scanner. With DAT_IMAGEINFO
command, this A6 scanner start to scan the paper, and after scanning complete, I could finally recieve the TW_IMAGEINFO
structure.
I don't receive any TWRC_CHECKSTATUS
while setting the UI mode.
So does this particular scanner actually doesn't support twain without UI?
Or could I have something workaround to disable this UI?
Actually a lot depends on the driver implementation.
So what happens is the options you set from the application configures the driver based on the capabilities it supports. If the driver capability for UI-less scanning is not allowed to be configurable by the driver in that case your application implementation may not work as expected.
Please refer to the TWAIN documentation for complete details.