Hello,
I am using the sample code, specifically the AcquireImageModal routine, and my application loses focus after acquiring an image.
I am activating the main form after the image is acquired, but it still results in a * window (losing focus, then activating)
Is there something that can be done to remedy this behavior?
Thanks,
Nate
Losing Window Focus
Moderator: Alex
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: Losing Window Focus
Hello Nate,
What TWAIN driver do you use?
Best regards, Alexander
What TWAIN driver do you use?
Best regards, Alexander
-
- Posts: 4
- Joined: Wed Jun 26, 2019 4:37 pm
Re: Losing Window Focus
I'm using the 32bit CanoScan 9000F Mark II driver
-
- Posts: 4
- Joined: Wed Jun 26, 2019 4:37 pm
Re: Losing Window Focus
aha, I figured out the culprit.
I am disabling the form (effectively disabling all the controls) and then re-enabling the form before/after the image acquisition. That must be messing with the Window handle being passed to the TWAIN driver?
Once I remove that, everything works as expected.
Thanks!
I am disabling the form (effectively disabling all the controls) and then re-enabling the form before/after the image acquisition. That must be messing with the Window handle being passed to the TWAIN driver?
Once I remove that, everything works as expected.
Thanks!
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: Losing Window Focus
Thank you for information.
How do you initialize instance of DeviceManager class? Do you pass the WinForm object or windows handle to the constructor of DeviceManager class?
Please pass information about parent window to the constructor of DeviceManager class and this also may solve the problem.
Best regards, Alexander
How do you initialize instance of DeviceManager class? Do you pass the WinForm object or windows handle to the constructor of DeviceManager class?
Please pass information about parent window to the constructor of DeviceManager class and this also may solve the problem.
Best regards, Alexander
-
- Posts: 4
- Joined: Wed Jun 26, 2019 4:37 pm
Re: Losing Window Focus
using (DeviceManager deviceManager = new DeviceManager(this))
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: Losing Window Focus
This is correct code. I think your solution with disabling/enabling UI is the best solution for your TWAIN driver.mrnate wrote: Wed Jun 26, 2019 5:53 pm using (DeviceManager deviceManager = new DeviceManager(this))
Best regards, Alexander