Announcement

Collapse
No announcement yet.

Asking about the SCREEN Scale ang Layout

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Asking about the SCREEN Scale ang Layout

    Hi.. i am asking, is there a way especially in MemeryEx of Imagine Programming to get or determine the windows screen Scale and Layout? because of the the laptop is using 125 to 150% scale as default settings.. if there can anyone share? thank you so much...

  • #2
    The simplest solution would be to get the logical and vertical heights of the device your application lives on;

    Globals:
    Code:
    local user32 = Library.Load("user32.dll");
    local gdi32  = Library.Load("gdi32.dll");
    local VERTRES = 10;
    local DESKTOPVERTRES = 117;
    function GetDpiScale()
        local hWnd = Application.GetWndHandle();
        local dc = user32.GetDC(hWnd);
        
        local logicalScreenHeight = gdi32.GetDeviceCaps(dc, VERTRES);
        local physicalScreenHeight = gdi32.GetDeviceCaps(dc, DESKTOPVERTRES);
        local dpiScalingFactor = physicalScreenHeight / logicalScreenHeight;
        
        user32.ReleaseDC(hWnd, dc);
        
        return dpiScalingFactor;
    end
    Usage:
    Code:
    local scalingFactor = GetDpiScale();
    local scalingPercentage = scalingFactor * 100;
    I have not tested this with multiple monitors though, as that is a bit more complex.
    Bas Groothedde
    Imagine Programming :: Blog

    AMS8 Plugins
    IMXLH Compiler

    Comment


    • #3
      Here's a more extended example that works on multiple (physical) displays.
      Attached Files
      Bas Groothedde
      Imagine Programming :: Blog

      AMS8 Plugins
      IMXLH Compiler

      Comment


      • #4
        Hi Imagine Programming thanks for this i will check and i will give you feedback.. thank you

        Comment


        • #5
          Hi, Imagine Programming it works.. i am curios if we can change the settings of scale directly in the ams application?

          Comment


          • #6
            Anyway thank you so much for the codes for memory ex

            Comment


            • #7
              Originally posted by telco View Post
              Hi, Imagine Programming it works.. i am curios if we can change the settings of scale directly in the ams application?
              I'm not sure if that's possible from AMS, as I don't know if Windows has an API for that. If it exists, it is possible.
              Bas Groothedde
              Imagine Programming :: Blog

              AMS8 Plugins
              IMXLH Compiler

              Comment


              • #8
                Thanks IP, i thinks your solution is good already.. thank you again..

                Comment

                Working...
                X