1. Frank Turro
  2. PowerBuilder
  3. Friday, 16 September 2022 13:12 PM UTC

We are using EZTwain Pro 4 to interface with scanners connected directly to users desktops. Immediately after calling the scan function

li_rtn = TWAIN_AcquireMultipageFile(0, ls_fullfilename)

the application resizes itself, the title bar is partially hidden, datawindow positions are moved, etc.

The document is scanned in successfully and we get a zero (successful) return code.

This seems to only happen on desktops where the user has their windows display setting set at 125%.  If it's 100%, everything works fine.

Also, it only happens on the compiled version of the application. If we run it from the PB IDE, or through degug, we don't get the issue.

The following is the code we are executing:

TWAIN_ResetAll()
TWAIN_SetHideUI(TRUE)

TWAIN_SetFileAppendFlag(FALSE)
TWAIN_SetJpegQuality(75)
TWAIN_SetStopOnEmpty(TRUE)

TWAIN_AcquireMultipageFile(0, ls_fullfilename)

IF TWAIN_LastErrorCode()<>0 THEN
    TWAIN_ReportLastError("Unable to scan.")
    RETURN -1
END IF

We are developing in PB2021 Standard Edition (Build 1509).

Has anyone else experienced a similar problem? Is there a solution or work-around?

Frank Turro Accepted Answer Pending Moderation
  1. Wednesday, 23 August 2023 15:50 PM UTC
  2. PowerBuilder
  3. # 1

Yes. We found it was a Windows DPI setting.  SetProcessDpiAwareness(1)

We put it in the Open event of our application object and it fixed the problem for us.

This link explains the issue

c# - DPI Awareness - Unaware in one Release, System Aware in the Other - Stack Overflow

Comment
  1. Armeen Mazda @Appeon
  2. Wednesday, 23 August 2023 19:18 PM UTC
Thanks for sharing the solution!
  1. Helpful
There are no comments made yet.
MARKOVIC Marko Accepted Answer Pending Moderation
  1. Wednesday, 23 August 2023 15:09 PM UTC
  2. PowerBuilder
  3. # 2

Hi Frank,

do you got a solution for your behaviour, we also have the same behavior with a older version 3.43 of EZTwain and still don't have a workaround. Thanks four feedback.

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 16 September 2022 16:12 PM UTC
  2. PowerBuilder
  3. # 3

Hi Frank;

   Just a thought .. try putting a Window.SetRedraw ( FALSE) before the TWAIN code and then a Window.SetRedraw ( TRUE ) after all the TWAIN code completes. HTH

Regards ... Chris

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.