Tattakashi123 / t

Automatically exported from code.google.com/p/twaindotnet
0 stars 0 forks source link

XFerReady message not arriving until source TWAIN window loses focus #31

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
This problem has been seen using a specialised medical TWAIN capture device. 
Essentially the source TWAIN window contains 2 buttons:

Btn 1 - Freezes a still image (source TWAIN window shows a live-preview)
Btn 2 - 'Saves' the image (this does not itself transmit a XFerReady message 
but appears to set a flag so that XFerReady is sent when the user closes the 
window)

What steps will reproduce the problem?

1. Get the specialist TWAIN window to appear
2. 'Save' the image (set the flag)
3. Close the TWAIN window
4. The image is not received by TwainDotNet until the source TWAIN window loses 
focus.

What is the expected output? What do you see instead?

I have a breakpoint set in the 'switch (_eventMessage.Message)' at the 
'Exception exception = null' line in the Message.XFerReady handler that should 
fire as soon as I click the 'X' in the source TWAIN window.

This breakpoint is not fired until the source TWAIN window loses focus by 
clicking anywhere outside that window - then the breakpoint is fired.

Thinking it may be an issue with this manufacturer's TWAIN implementation I 
tested the same source TWAIN window in Picasa 3 and it worked without issue.

What version of the product are you using? On what operating system?

Windows 7 64-bit - latest updates as of 24/06
Source available as at 17/06

Please provide any additional information below.

Thinking that my host application could be causing the problem I performed the 
same steps using the 'TestAppWpf' solution and noted the symptoms were the 
same. TwainDotNet does not get the XFerReady message until the source TWAIN 
window loses focus (click anywhere outside of it)

Original issue reported on code.google.com by mark.amb...@gmail.com on 24 Jun 2011 at 3:08

GoogleCodeExporter commented 8 years ago
I have more or less the same problem. My WPF windows does not get close 
messages as long as the Twain-Windows has the focus. Immediately if twain 
windows looses focus, the message (which must be queued for a while) arrives. I 
have this under Windows 7 32 and Windows XP both with different scanners and 
drivers.

Original comment by Mungo...@gmail.com on 28 Jun 2011 at 6:59

GoogleCodeExporter commented 8 years ago
Try this
public bool UseFilter
    {
      get
      {
        return _usingFilter;
      }
      set
      {
        if (!_usingFilter && value == true)
        {
          System.Windows.Interop.ComponentDispatcher.ThreadFilterMessage +=
      new System.Windows.Interop.ThreadMessageEventHandler(this.ThreadFilterMessage);
   //    _source.AddHook(FilterMessage);
          _usingFilter = true;
        }

        if (_usingFilter && value == false)
        {
          System.Windows.Interop.ComponentDispatcher.ThreadFilterMessage -=
      new System.Windows.Interop.ThreadMessageEventHandler(this.ThreadFilterMessage);
    //      _source.RemoveHook(FilterMessage);
          _usingFilter = false;
        }
      }
    }

Original comment by Joe.Ka...@gmail.com on 23 Feb 2012 at 5:29