Well, I did some research last night and discovered that Microsoft has been making a series of changes to how Windows manages adjustments (both manual and automatic) to DPI scaling since Windows 8.1. Automatic adjustments in scaling occurs when tablet users dock/undock to/from single or multi-monitor workstations, for example. Higher resolution monitors and displays also have made an impact on this issue. In later versions, Windows no longer requires a Logoff/Logon to make a scaling adjustment, but instead handles such changes on the fly.
There are many new API functions to support this new functionality. Apps can now individually manage DPI scaling themselves with this functionality.
A consequence of these changes is that the traditional method of asking Windows for DPI scaling information ALWAYS returns a value of 96 dots/logical inch, regardless of the actual setting. As I understand it, this was done so as not to break the zillions of existing Windows applications. This explains why Vlad consistently gets the results he does. I used Windows 7 OS to create the code I offered, which works as intended in that and in earlier versions of Windows.
It is not immediately clear how to use the new API functions to obtain the "real" DPI scaling that is in effect for an application. As usual, Microsoft doesn't do a great job of providing sample code. To add to the complexity, the functionality and the corresponding API set has evolved over several Windows releases, so some API's cannot be used prior to Win8.1 and others prior to Win10 (1607) and there may be some critical releases in between. Interrogation code will have to first determine the OS version and build in order to know what API's are available. Roland's OSVersion free code example on the TopWizProgramming web site will help some. It's not rocket science, but this will take some experimentation to figure out. It looks like the new GetDpiForSystem, GetDpiForMonitor and GetDpiForWindow API's and possibly others will need to be used.
I will work on this as my spare and evening time permits, but cannot make any promises when I will have a solution code that works across all versions of the Windows OS. Others are welcome and encouraged to come up with a solution.
John
Simple tuning:: In your app object -- create ue_preloader -- unmapped event -- call every global function in this event throwing in whatever local variables are needed from compiler's view point. This event never executes. However, just referencing the global functions may preload all of them into memory. Great!
Unfortunately this means you cannot ever bugfix any of them by adding a .PBD to front of library list using SetLibraryList - since all global functions are already in memory and remain their.
Performance tuning is complex! -- and I better get my facts straight before committing to this isn actual behavior. -- experiments; fact-finding; etc. before actually writing the articles.
Thanks for all the info and doing a great job Michael !
Very interesting to find that my findings of global functions only loading once are correct but ..... NOT for global functions used in datawindow attributes. In that last case they ARE reloaded many times when you come back in a window.
The solution has been what Michael already found out:
In my application manager object I have this IF:
IF 1 = 2 THEN
// all of my global function calls which I use.
END IF
That way, also for those used in datawindow expressions / attributes, are only loaded ONCE.