Page 1 of 1

Setup screen hanging application

Posted: Fri Aug 03, 2018 2:01 pm
by NickHallas
I have a WPF application from which I'm trying to invoke the Twain setup configuration dialog. I'm using code like:

Code: Select all

var handle = new System.Windows.Interop.WindowInteropHelper(this);
using (var picture = new GdPicture14.GdPictureImaging())
{
    picture.TwainOpenDefaultSource(handle.Handle);
    picture.TwainShowSetupDialogSource(handle.Handle);
    picture.TwainCloseSource();
}
This puts the scanner's dialog up OK. However, when I close the dialog, my UI is no longer responsive. My suspicion is that it's connected with the window handle from the WPF application.

Scanning itself is working OK; it just seems to be the setup dialog.

If it helps, the scanner is a Fujitsu, coming up as PaperStream IP fi-6670dj, and I'm using GDPicture 14.0.0.60.

Any suggestions welcome.

Re: Setup screen hanging application

Posted: Fri Aug 03, 2018 2:53 pm
by NickHallas
Actually; on further investigation, it's a little more complex. The UI is mostly active, but the highlighting of buttons control as the mouse is moved over no longer works, so it gives the impression of being inactive.

Clicking a button does invoke the handler.

Closing the window (which is the main application window) makes it disappear from the screen and task bar, but the application itself remains running with no UI displayed.

Re: Setup screen hanging application

Posted: Fri Aug 03, 2018 3:43 pm
by NickHallas
Another update on this - I've got it forking by creating a hidden WinForm window, and using that to provide the window handle.

(But that really is a hack).

Re: Setup screen hanging application

Posted: Wed Jan 16, 2019 7:27 pm
by Loïc
Hi,

Actually that's not such a hack but most a good practice for twain scanning. That said, you don't need to do that. Just pass intptr.zero as parameter to twain methods to specify "no window owner" and the Toolkit will internally create its own internal window for the message loop.

Best regards,

Loïc