Jump to content

What exactly does HiDpi=Y set? ... and where?


qwert
 Share

Recommended Posts

Once again, I'm delving into the strange—and changing in Win10—realm of High DPI Displays.  Things that I thought were settled seem back in play.

As a test, I prepared two simple GUIs ... one with HiDpi=Y ... and with HiDpi=N.

They ARE treated differently on a Win10 PC running at 125%.  But the DPI parameters in Properties show exactly the same settings: nothing is set.  Yet by changing the settings in Properties, I can change the displayed GUI on that PC.

So, what does, exactly, does #AutoIt3Wrapper_Res_HiDpi=Y do?  I couldn't find a definitive answer in any post.

Any help will be appreciated.

 

5b12f58a4fe9a_HiDPIProperties.png.0735cb82e04a818f1c4d338ceb24a9fa.png

 

Edited by qwert
Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

This remains the #1 question in my quest to understand the choices for managing GUIs for HiDPI displays.

The week, I've experienced Win10 showing the opposite for installed EXEs:

With NO wrapper setting, Win10 shows "Override ... with scaling performed by Application"

On an EXE where HiDpi-Y, Win10 shows "Override ... with scaling performed by System(Enhanced)"

Does anyone know why this might be?

Link to comment
Share on other sites

#AutoIt3Wrapper_Res_HiDpi=Y makes your program DPI aware through an application manifest. See this thread and Microsoft documentation.

Edited by LarsJ
Wrong link
Link to comment
Share on other sites

@LarsJ: thanks for your response.

The link you listed led me to this page that seems to represent the latest from MSFT: latest

It's obvious that there's a lot involved ... including a new "mixed-mode DPI scaling".  Plus, it's disconcerting that MSFT includes this statement:

Quote

We recommended that you specify the default process DPI awareness via a manifest setting. While specifying the default via API is supported, it is not recommended.

What I'm currently experiencing (and investigating) is that when Win10 interprets an EXE's manifest and shows the DPI scaling settings in the Properties dialog, it's different from what I declared at compile time. It's why I'm trying to follow what's set in the EXE's manifest and then figure what else is coming into play.

Probably worst of all is that I've found that a GUI-based EXE will run fine on its own ... but will display its GUI incorrectly when run from one of my EXEs that has the opposite HiDpi setting (a script without a GUI, for example). It's like the DPI scaling is somehow inherited. (This is all under Win10, BTW ... but running EXEs that are compiled on Win7.)

Anyway, I appreciate the information and will post what I eventually find.

 

5ba3d9709d305_HiDpiconfusion.png.9cb4cf5beaddb90eb5438590dc33a7c8.png

Link to comment
Share on other sites

  • Developers
On 7/24/2018 at 1:28 AM, qwert said:

I'll try once more.  Does anyone know?

What, exactly, does #AutoIt3Wrapper_Res_HiDpi=Y do?

Sure, and pretty easy to figure out too as autoit3wrapper.au3 contains the logic. ;)

All it does is add this to the manifest of the compiled program:

If $INP_RES_HiDpi <> "n" Then
                    FileWriteLine($hTempFile2, '    <asmv3:application>')
                    FileWriteLine($hTempFile2, '        <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">')
                    If $INP_RES_HiDpi <> "y" Then
                        Write_RC_Console_Msg("Setting DPI awareness Manifest information to true/PM", "", "...", 0)
                        FileWriteLine($hTempFile2, '              <dpiAware>true/PM</dpiAware>')
                    Else
                        Write_RC_Console_Msg("Setting DPI awareness Manifest information to true", "", "...", 0)
                        FileWriteLine($hTempFile2, '              <dpiAware>true</dpiAware>')
                    EndIf
                    FileWriteLine($hTempFile2, '        </asmv3:windowsSettings>')
                    FileWriteLine($hTempFile2, '    </asmv3:application>')
                    FileWriteLine($hTempFile2, '')
                EndIf

The option can be N/Y/P  or No/Yes/PM.
The details are explained on the Microsoft site as you have found already i guess.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

@Jos, thanks for the clarifications.

At this point, I'm a little disoriented by the results I'm seeing. For example, MSFT's Process Explorer shows DPI Awareness = Unaware on Win10 for the EXE's that I compiled with HiDpi=Y.

But the biggest possible (probable?) factor is that I'm running 2017 versions of Au3 and SciTE.  Before I continue, I'm going to upgrade to 3.3.14.5 so that anything I determine is completely current.

This might take me a couple of days, since my development environment is pretty complicated. And just to clarify: I build on Win7 ... run on Win7 and Win10 ... on both HiDPI and normal monitors (but not both at the same time ... at least not yet).

Thanks, again.

 

Link to comment
Share on other sites

  • Developers

No need to upgrade your current setup. Just download the zip version of the latest Autoit3 and store it in a separate directory. Then add this directive to the scrip and point it to this separate setup:

#AutoIt3Wrapper_AutoIt3Dir=

Compile the script and your in business. This should have no impact and makes testing easy. ;)

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

1 hour ago, Jos said:

No need to upgrade your current setup.

What a welcome bit of advice! ... "wow", actually.  I've been using AutoIt3 for almost 10 years and that directive never entered my view.  (I guess I can stop dreading upgrades!)

Thanks, Jos.

Link to comment
Share on other sites

As far as I know/remeber this solution worsk but compiled program must be run on Win8.1 or Win10  :)

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • Developers
39 minutes ago, qwert said:

Is there a compiler setting for this?

Obviously not (yet). ;)

What about when you try modifying the lines in AutoIt3Wrapper to what you think it should be, test to see if it all works and send me the new version so I can merge it into the current version?

Jos

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

2 minutes ago, Jos said:

what you think it should be

I'd love to be able to do that with any confidence. But I was just looking at the AutoIt3Wrapper.au3 statements and immediately I'm not at all clear on how to handle /SMI/2005/ versus /SMI/2016/.  Specify only the latest? Or use both in different segments of statements?

I'll be glad to make changes and run tests, but I'm facing these questions. Can you recommend a proper course?

Link to comment
Share on other sites

  • Developers

Ok, replace the section I posted with this and see if that works for you:

If $INP_RES_HiDpi <> "n" Then
                    FileWriteLine($hTempFile2, '    <application xmlns="urn:schemas-microsoft-com:asm.v3"> ')
                    FileWriteLine($hTempFile2, '        <windowsSettings>')
                    FileWriteLine($hTempFile2, '        <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>')
                    If $INP_RES_HiDpi <> "y" Then
                        Write_RC_Console_Msg("Setting DPI awareness Manifest information to true/PM", "", "...", 0)
                        FileWriteLine($hTempFile2, '        <dpiAware>true/PM</dpiAware>')
                    Else
                        Write_RC_Console_Msg("Setting DPI awareness Manifest information to true", "", "...", 0)
                        FileWriteLine($hTempFile2, '        <dpiAware>true</dpiAware>')
                    EndIf
                    FileWriteLine($hTempFile2, '        </windowsSettings>')
                    FileWriteLine($hTempFile2, '    </application>')
                    FileWriteLine($hTempFile2, '')
                EndIf

I have no means of testing so am stabbing in the dark here... :)

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Will do.  But I'm going to pause for a couple hours and think over the choices one more time.  The statements you've posed don't specifically cover the ones I thought I was concerned with at this point:

<dpiAwareness>unaware</dpiAwareness> ... so system handles DPI differences by default

<dpiAwareness>system</dpiAwareness> ... so system handles DPI difference by a clear directive

But it does appear that <dpiAwareness>PerMonitorV2</dpiAwareness> covers the general case of "Application is Aware" (and will handle differences in DPI ... which is the old HiDPI=Y).

Link to comment
Share on other sites

  • Developers

Sounds good. I haven't read up on all options for this so need to understand what they all are now to be able to produce the right logic/option for the directive.
So any input there is welcome.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...