TWAIN: Main Window scaled after Close/Unload Source

General discussions about GdPicture.NET.
Post Reply
Macedot
Posts: 7
Joined: Wed Jun 02, 2021 6:47 pm

TWAIN: Main Window scaled after Close/Unload Source

Post by Macedot » Fri Nov 12, 2021 4:48 pm

Preface:
This issue was first observed using GdPicture with C++ COM interop and occurs after calling TwainGetState without calling any other GDP TWAIN function previously. On this occasion we monitored our Main Window for any WM_SIZE messages on its Procedure. Our window didn't received any thus we are calling it a rescale (due to internal Windows scaling process) not resize (done thought Window Messages on its callback procedures under Win32API).

How to Reproduce:
-> On Windows video/display settings, change the display scaling value to anything but 100% (125% on my case)
-> Run the C# Demo app for TWAIN scanning;
-> Click either "Close Source Manager" or "Unload Source Manager" button;
-> After calling TwainCloseSourceManager/TwainUnloadSourceManager method, the main window will be rescaled (not resized!) with no reason :lol:

OS version: Win10 21H1
GDP version: 14.1.138 (Nov 08)
Source code for demo: GdPicture.NET14\Samples\GdPicture\WinForm\C#\TWAIN Scanning

Cheers!

Hugo
Posts: 227
Joined: Tue Dec 18, 2018 10:09 am

Re: TWAIN: Main Window scaled after Close/Unload Source

Post by Hugo » Mon Nov 15, 2021 5:49 pm

Hi there,

Thank you for your feedback.

As you mention you are having issues with application's DPI awareness, we are aware in some cases this may occur. This can be fixed using the following links:
https://social.msdn.microsoft.com/Forum ... =vbgeneral
https://stackoverflow.com/questions/502 ... -the-other

The solution is to configure the application, at startup to declare it DPI aware or not. Is this is not done, the state will be unknown and the first call to SetProcessDpiAwareness, from any component will possibly change the behavior.
Basically, just call the windows api SetProcessDpiAwareness.

This has been suggested to others with the same problem in the past and it has solved the issue for them.
Let me know if you still experience any issues.

Regards,
Hugo Cudd
Technical Support

Macedot
Posts: 7
Joined: Wed Jun 02, 2021 6:47 pm

Re: TWAIN: Main Window scaled after Close/Unload Source

Post by Macedot » Thu Nov 18, 2021 4:46 pm

Thanks Hugo!

That's seems to be the issue indeed. Seems that we got stuck supporting legacy Windows versions so we're lacking some proper handling for that matter.

Cheers!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest