Losing Window Focus

Questions, comments and suggestions concerning VintaSoft Twain .NET SDK.

Moderator: Alex

Post Reply
mrnate
Posts: 4
Joined: Wed Jun 26, 2019 4:37 pm

Losing Window Focus

Post by mrnate »

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
Alex
Site Admin
Posts: 2045
Joined: Thu Jul 10, 2008 2:21 pm

Re: Losing Window Focus

Post by Alex »

Hello Nate,

What TWAIN driver do you use?

Best regards, Alexander
mrnate
Posts: 4
Joined: Wed Jun 26, 2019 4:37 pm

Re: Losing Window Focus

Post by mrnate »

I'm using the 32bit CanoScan 9000F Mark II driver
mrnate
Posts: 4
Joined: Wed Jun 26, 2019 4:37 pm

Re: Losing Window Focus

Post by mrnate »

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!
Alex
Site Admin
Posts: 2045
Joined: Thu Jul 10, 2008 2:21 pm

Re: Losing Window Focus

Post by Alex »

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
mrnate
Posts: 4
Joined: Wed Jun 26, 2019 4:37 pm

Re: Losing Window Focus

Post by mrnate »

using (DeviceManager deviceManager = new DeviceManager(this))
Alex
Site Admin
Posts: 2045
Joined: Thu Jul 10, 2008 2:21 pm

Re: Losing Window Focus

Post by Alex »

mrnate wrote: Wed Jun 26, 2019 5:53 pm using (DeviceManager deviceManager = new DeviceManager(this))
This is correct code. I think your solution with disabling/enabling UI is the best solution for your TWAIN driver.

Best regards, Alexander
Post Reply