Search the Community
Showing results for tags 'dpi awareness'.
-
Since this thread is getting long, I thought I'd copy all the relevant information to the 1st post. Three different types of DPI Aware'ness are made available from Microsoft. 1. System Aware (introduced with Windows Vista) 2. Per Monitor Aware (Introduced with Windows 8.1) 3. Per Monitor Aware V2 (Introduced with Windows 10 1703) Method #1 - Programmatically - Only available for Windows 8.1 and 10 ; For values available to Windows 10 users - https://docs.microsoft.com/en-gb/windows/win32/hidpi/dpi-awareness-context If @OSVersion = 'WIN_10' Then DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext" , "HWND", "DPI_AWARENESS_CONTEXT" -2) If @OSVersion = 'WIN_81' Then DllCall("User32.dll", "bool", "SetProcessDPIAware") ; *** Microsoft warns that these entries need to be executed before the GUI is created *** ;This is the only reason they recommend using the Manifest method over the programmatic method When using the above code, Windows 10 and 8.1 will recognize your compiled app as DPI System Aware. Method #2 - using Manifest entries - Available for all Windows starting with Vista, up to current and future releases of Windows. Using #AutoIt3Wrapper_Res_HiDpi=Y will set your compiled app as DPI System Aware (Win Vista, 7, 8.1, 10). For Windows 8.1, using the Manifest method is the only way to have Per Monitor Aware. Follow this link to learn how to create Per Monitor Aware and Per Monitor Aware V2 apps for Windows 10. Learn how here *** This is the Microsoft recommended method of creating a DPI Aware application *** *** If you choose either method above, you will still need to deal with the GUI itself and all of its Controls. *** Being DPI Aware only deals with text. The simplest method to achieve this is to adapt the code below into your script. Global $iScale = RegRead("HKCU\Control Panel\Desktop\WindowMetrics", "AppliedDPI") / 96 GUICreate("DPI test", 200 * $iScale, 100 * $iScale) GUICtrlCreateButton("Ima Button", 35 * $iScale, 115 * $iScale, 55 * $iScale, 21 * $iScale) ; For reference, I have a single App with 579 occurances of $iScale ; Also know; I've had to make some small x,y adjustments to keep the GUI looking good but nothing drastic. ; Be sure to test your compiled app at 125% and at 200%. This is how I found small descrepancies requiring x,y adjustments. more importantly, this registry value can be had, programmatically and in my opinion, more efficiently With 4k monitors becoming a norm, this should set you well on your way to creating a DPI Aware applications that looks good on any system.
-
Hello dears, I'm trying to write a script in AutoIT but, I have issue in DPI. I'm basically a Lead Software Developer and I use AutoIT from time to time. I have an ERP Launcher that should work on all machines starting by Windows 7, Windows 8.x , Windows 10, Windows Server 2003/2008/2012. When I was searching in AutoIT forum, I could see previously this " Writing DPI Awareness App - workaround" in the signature of Mr. @mLipok,, but clicking on the link, => page not found. Do you have any new link or something that you can share with me ? I'm using macbook pro with retina display and VMware machines: Windows 10 and Server 2012 as development machines, but both of them they have 200% scaling and they have AutoIT installed. In this case, when I use Koda (blurry font for sure), I have the controls as I want, and application is working fine, but also blurry font, until it is used on 96 DPI machine. Now, in windows 10, with DPI System Enhanced feature in the compatibility tab, the application running on 200% scaling is excellent visual like it's running on 96 DPI without touching my code and without doing anything, but no all clients they have windows 10. It seems Microsoft worked a lot on the new feature. But for other machines like windows 7/8/2012, the font is blurry if the clients have scaling above 100% (more than 96 DPI). I know how to enable hidpi stuff in the wrapper and I know how to write the code to use a scaling factor that can be multiplied by every coordinate, but this way is cumbersome and I have to change all coordinates of all X, Y, Width, Height after getting the code from Koda. Is there a fast way ? So, what do you recommend me guys ? Thanks, Jowy