This is neccessary according to the Twain specification and also allows much more comfortable user interfaces.
The Twain specification is clear that event processing in the main application must be provided while the data source shows it's User Interface:
``` "You cannot use the modal dialog creation call DialogBox( ) to create the Source’s user interface main window. To allow event processing by both the application and the Source, this call cannot be used" ```
This was already documented that way in Twain Specification 1.8.
According to the specification, MSG_ENABLEDS only creates the dialog and then returns. But the implementation in ui.c with the call to CreatePropertySheetW equals a "DialogBox" call and returns only when the user clicks OK or CANCEL.
This Merge Requests sets PSH_MODELESS to make CreatePropertySheetW create a non-modal dialog and then returns control back to the application.
To avoid crashes, some of the pointers passed to CreatePropertySheetW must stay valid as long as the dialog remains open. A pointer to an additional struct SUiData is stored with the activeDS and cleared when the user interface is cleared with DestroyWindow on MSG_DISABLEDS. To reduce the number of changes in the source code, the PROPSHEETHEADERW is not part of the struct as no problems were observable.
The user interface is no longer automatically closed after every scan. Depening on the application program, it can stay open, ready for the next scan with just a click on the "Scan" button, which results in a much easier and faster user interface experience.
For example the user might modifiy settings like resolution or brightness and start a second scan with the modified parameters with a singe click.
The progress dialog is modified
* to use the UI dialog as it's parent window. * And get created centered on the user interface dialog instead of the screen.
Application orograms I found to profit from the modified behaviour:
* IrfanView 4.7.2 if the Button "Close Twain dialog after acquiring an image" is disabled. * The simple memxfer.c source I recently attached to an older merge request.