Setup screen hanging application

Discussions about TWAIN & WIA scanning in GdPicture.NET using GdPictureImaging.
Post Reply
NickHallas
Posts: 4
Joined: Fri Aug 03, 2018 1:45 pm

Setup screen hanging application

Post by NickHallas » Fri Aug 03, 2018 2:01 pm

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.

NickHallas
Posts: 4
Joined: Fri Aug 03, 2018 1:45 pm

Re: Setup screen hanging application

Post by NickHallas » Fri Aug 03, 2018 2:53 pm

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.

NickHallas
Posts: 4
Joined: Fri Aug 03, 2018 1:45 pm

Re: Setup screen hanging application

Post by NickHallas » Fri Aug 03, 2018 3:43 pm

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).

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Setup screen hanging application

Post by Loïc » Wed Jan 16, 2019 7:27 pm

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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest