argumentum Posted August 1, 2023 Posted August 1, 2023 (edited) That's the way it looks from creating in the 4k monitor at 225% and moved to the 1080p 100% monitor. Looks fine going back to the primary monitor but not on creation, as it looks small on creation. (I'll be removing these pics later on after you've seen them to save space in my user usage) Using imgbb. 1 hour ago, UEZ said: I hope you don't mind me doing something similar in parallel. Actually, I'm the one that should say that !. Am "piggy back" from your code And yes, I'm working on it on my side as we speak post. I'm thinking of posting my progress later ( say 6 hours ) on my thread We ( in the AutoIt project/forum ) may have overlooked this need for years but we have to acknowledge that is needed. Edited August 1, 2023 by argumentum using imgbb Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
UEZ Posted August 1, 2023 Author Posted August 1, 2023 @argumentum thanks for testing. Which os you are using? Btw, you can upload image here: imgbb.com and link it directly to the forum. Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
argumentum Posted August 1, 2023 Posted August 1, 2023 Windows Server 2022 Standard (21H2) 20348.1850 I'll explore imgbb, thanks for the idea. Posted ( as a ZIP ) what I was gonna post in 6 hour, so we can compare notes. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Shark007 Posted August 1, 2023 Posted August 1, 2023 (edited) @UEZ , I realize this is not the information you're asking for but I want to share. Take notice of the clarity of the text in the 2 pics attached. For completeness, I suggest you open taskmgr.exe and then switch that to Details View. Rightclick the Header row and choose "Select columns" - scoll to near the bottom and select [x] DPI Awareness This will display the awareness state of the executible. Of the 2 pics attached, the 1st one is using your code with no modification, and the second one is using #AutoIt3Wrapper_Res_HiDpi=Y with the exe's manifest containing <asmv3:application> <asmv3:windowsSettings> <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True</dpiAware> </asmv3:windowsSettings> </asmv3:application> Edited August 1, 2023 by Shark007
UEZ Posted August 1, 2023 Author Posted August 1, 2023 6 minutes ago, argumentum said: Windows Server 2022 Standard (21H2) 20348.1850 I'll explore imgbb, thanks for the idea. Posted ( as a ZIP ) what I was gonna post in 6 hour, so we can compare notes. Some of the function are not supported by server os. @Shark007 which os you are using? When I use #AutoIt3Wrapper_Res_HiDpi=Y then WM_DPICHANGED will be by-passed and the clarity is gone. Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Shark007 Posted August 1, 2023 Posted August 1, 2023 (edited) I am on Windows 11 22H2 I use a personally modified version of AutoIt3Wrapper.au3 because I wanted the exact code I posted above in my manifests. #AutoIt3Wrapper_Res_HiDpi= ??? Should be researched because there are different ways to invoke DPI awareness such as Monitor V1 and V2 etc. EDIT, also know, those screenshots were taken @ 350% on a 4K monitor. 2. I used your posted code to create those exe's with the only diff be the manifest change. Edited August 1, 2023 by Shark007
argumentum Posted August 1, 2023 Posted August 1, 2023 ..whatever we put together should work anywhere from WinXP/Server2003, all the way to the present. If the DllCall(s) worked then it works, else, run as we didn't even try. But should look blurry as not DPI aware, or just fine. ..we'll get there Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
argumentum Posted August 1, 2023 Posted August 1, 2023 5 minutes ago, Shark007 said: 2. I used your posted code to create those exe's with the only diff be the manifest change. ..interesting. Thanks for sharing. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
UEZ Posted August 1, 2023 Author Posted August 1, 2023 (edited) My AutoIt3Wrapper.au3 section: If $INP_RES_HiDpi <> "n" Then FileWriteLine($hTempFile2, ' <asmv3:application>') FileWriteLine($hTempFile2, ' <asmv3:windowsSettings>') If $INP_RES_HiDpi = "p" Then Write_RC_Console_Msg("Setting DPI awareness Manifest information to true/PM", "", "...", 0) FileWriteLine($hTempFile2, ' <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware>') FileWriteLine($hTempFile2, ' <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2,PerMonitor</dpiAwareness>') Else Write_RC_Console_Msg("Setting DPI awareness Manifest information to true", "", "...", 0) FileWriteLine($hTempFile2, ' <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True</dpiAware>') EndIf FileWriteLine($hTempFile2, ' </asmv3:windowsSettings>') FileWriteLine($hTempFile2, ' </asmv3:application>') FileWriteLine($hTempFile2, '') EndIf I cannot remember if I changed it or Jos. Edited August 1, 2023 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
argumentum Posted August 1, 2023 Posted August 1, 2023 (edited) .. the manifest portion looks the same on my side. Compiled as described but not with the same results as of @Shark007's. I mean, with _HiDpi=p and _HiDpi=y but it looks tiny. Edit: I'm on win 10, not 11. I'd have to try that in Win11 but nonetheless, whatever we put out there should be as functional as possible, even if it takes an extra sacrifice to the gods of the code ( in the form of code, I faint at the sight of blood ) Edited August 1, 2023 by argumentum Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Shark007 Posted August 1, 2023 Posted August 1, 2023 (edited) I omit the whole HiDPI=Y section of AutoIt3Wrapper.au3 because I wiped out that whole section and replaced it with this because this performs best for dragging from one monitor to another and I am unconcerned of not using Awareness. FileWriteLine($hTempFile2, '<asmv3:application>') FileWriteLine($hTempFile2, ' <asmv3:windowsSettings>') FileWriteLine($hTempFile2, ' <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True</dpiAware>') FileWriteLine($hTempFile2, ' </asmv3:windowsSettings>') FileWriteLine($hTempFile2, '</asmv3:application>') All software I create is DPI Aware. Edited August 1, 2023 by Shark007 argumentum 1
argumentum Posted August 1, 2023 Posted August 1, 2023 8 minutes ago, Shark007 said: I omit the whole HiDPI=Y section of AutoIt3Wrapper.au3 because.... If $INP_RES_HiDpi <> "n" Then FileWriteLine($hTempFile2, ' <asmv3:application>') FileWriteLine($hTempFile2, ' <asmv3:windowsSettings>') If $INP_RES_HiDpi = "p" Then _Write_RC_Console_Msg("Setting DPI awareness Manifest information to true/PM", "", "...", 0) FileWriteLine($hTempFile2, ' <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware>') FileWriteLine($hTempFile2, ' <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2,PerMonitor</dpiAwareness>') Else _Write_RC_Console_Msg("Setting DPI awareness Manifest information to true", "", "...", 0) FileWriteLine($hTempFile2, ' <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True</dpiAware>') EndIf FileWriteLine($hTempFile2, ' </asmv3:windowsSettings>') FileWriteLine($hTempFile2, ' </asmv3:application>') FileWriteLine($hTempFile2, '') Else ; https://www.autoitscript.com/forum/topic/210604-tester-needed/?do=findComment&comment=1522045 FileWriteLine($hTempFile2, '<asmv3:application>') FileWriteLine($hTempFile2, ' <asmv3:windowsSettings>') FileWriteLine($hTempFile2, ' <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True</dpiAware>') FileWriteLine($hTempFile2, ' </asmv3:windowsSettings>') FileWriteLine($hTempFile2, '</asmv3:application>') EndIf should do the same, unless you removed more than just that ? Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Shark007 Posted August 1, 2023 Posted August 1, 2023 (edited) Yes. I took that whole section out and put in the few lines I posted above. So I have no need for #AutoIt3Wrapper_Res_HiDpi=Y because the inquiry became redundant. Edited August 1, 2023 by Shark007 argumentum 1
argumentum Posted August 1, 2023 Posted August 1, 2023 ..went Win11 (remote desktop) at 300% and tried compiled ( green icon ) and the UDF we're working on ( blue icon ) ... you may have to open to view it elsewhere as the image could be bigger than your monitor. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
UEZ Posted August 1, 2023 Author Posted August 1, 2023 This DPI stuff is very tricky because of different os with different behavior. Let's see where we end... 😉 Shark007 and argumentum 2 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
UEZ Posted August 2, 2023 Author Posted August 2, 2023 Can you please test this version: expandcollapse popup;Build 2023-08-02 ; AutoIt GUI Example ; Created: 17/01/2005 - CyberSlug ; Modifed: 05/12/2011 - guinness ; Modifed: 09/06/2014 - mLipok ; Modifed: 15/10/2018 - mLipok ; Modifed: 01/08/2023 - UEZ #AutoIt3Wrapper_Change2CUI=n #AutoIt3Wrapper_Run_Au3Stripper=n #Au3Stripper_Parameters=/so #AutoIt3Wrapper_Res_HiDpi=y #AutoIt3Wrapper_UseX64=n #Region INCLUDE #include <AVIConstants.au3> #include <GuiConstantsEx.au3> #include <TreeViewConstants.au3> #include <Array.au3> #include <GUIConstantsEx.au3> #include <WinAPIGdiDC.au3> #include <WindowsConstants.au3> #include "_WinAPI_DPI.au3" #EndRegion INCLUDE #Region INITIALIZATION and EXIT Global $aCtrl[40][6], $ahWnd[1][10], $g_iDPI_ratio0, $g_iDPI_ratio1, $g_iDPI_ratio2 _Example() Exit ; Finished! #EndRegion INITIALIZATION and EXIT Func _Example() Local $AWARENESS Switch @OSBuild Case 9200 To 13999 $AWARENESS = $DPI_AWARENESS_PER_MONITOR_AWARE Case @OSBuild > 13999 $AWARENESS = $DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 EndSwitch Local $iDPI = _WinAPI_SetDPIAwareness($AWARENESS), $iDPI_PM = _WinAPI_GetDpiForWindow(_WinAPI_GetDesktopWindow()) $iDPI_PM = $iDPI_PM = 0 ? 96 : $iDPI_PM $g_iDPI_ratio1 = $iDPI / $iDPI_PM $g_iDPI_ratio2 = $iDPI_PM / $iDPI $g_iDPI_ratio0 = $g_iDPI_ratio1 > 1 ? 1 + (1 - $g_iDPI_ratio2) : 1 #Region GUI $ahWnd[0][1] = 8.5 * $g_iDPI_ratio2 $ahWnd[0][0] = GUICreate("Sample GUI", 400 * $g_iDPI_ratio1, 400 * $g_iDPI_ratio1) GUISetIcon(@SystemDir & "\mspaint.exe", 0) GUISetFont($ahWnd[0][1]) #EndRegion GUI #Region MENU $aCtrl[1][0] = GUICtrlCreateMenu("Menu &One") $aCtrl[2][0] = GUICtrlCreateMenu("Menu &Two") $aCtrl[3][0] = GUICtrlCreateMenu("Menu Th&ree") $aCtrl[4][0] = GUICtrlCreateMenu("Menu &Four") GUICtrlCreateMenuItem('SubMenu One &A', $aCtrl[1][0]) GUICtrlCreateMenuItem('SubMenu One &B', $aCtrl[1][0]) #EndRegion MENU #Region CONTEXT MENU $aCtrl[5][0] = GUICtrlCreateContextMenu() GUICtrlCreateMenuItem("Context Menu", $aCtrl[5][0]) GUICtrlCreateMenuItem("", $aCtrl[5][0]) ; Separator GUICtrlCreateMenuItem("&Properties", $aCtrl[5][0]) #EndRegion CONTEXT MENU #Region PIC $aCtrl[6][2] = 0 ;x $aCtrl[6][3] = 0 ;y $aCtrl[6][4] = 169 ;w $aCtrl[6][5] = 68 ;h $aCtrl[6][0] = GUICtrlCreatePic("c:\Program Files (x86)\AutoIt3\Examples\GUI\logo4.gif", $aCtrl[6][2] * $g_iDPI_ratio1, $aCtrl[6][3] * $g_iDPI_ratio1, $aCtrl[6][4] * $g_iDPI_ratio1, $aCtrl[6][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region PIC') $aCtrl[7][2] = 75 $aCtrl[7][3] = 1 $aCtrl[7][4] = 80 $aCtrl[7][5] = 16 $aCtrl[7][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[7][0] = GUICtrlCreateLabel("Sample Pic", $aCtrl[7][2] * $g_iDPI_ratio1, $aCtrl[7][3] * $g_iDPI_ratio1, $aCtrl[7][4] * $g_iDPI_ratio1, $aCtrl[7][5] * $g_iDPI_ratio1) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetFont(-1, $aCtrl[7][1] * $g_iDPI_ratio0) #EndRegion PIC #Region AVI $aCtrl[8][2] = 180 $aCtrl[8][3] = 10 $aCtrl[8][4] = 32 $aCtrl[8][5] = 32 $aCtrl[8][0] = GUICtrlCreateAvi("c:\Program Files (x86)\AutoIt3\Examples\GUI\SampleAVI.avi", 0, $aCtrl[8][2] * $g_iDPI_ratio1, $aCtrl[8][3] * $g_iDPI_ratio1, $aCtrl[8][4] * $g_iDPI_ratio1, $aCtrl[8][5] * $g_iDPI_ratio1, $ACS_AUTOPLAY) GUICtrlSetTip(-1, '#Region AVI') ; TODO $aCtrl[9][2] = 175 $aCtrl[9][3] = 50 $aCtrl[9][4] = 50 $aCtrl[9][5] = 12 $aCtrl[9][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[9][0] = GUICtrlCreateLabel("Sample avi", $aCtrl[9][2] * $g_iDPI_ratio1, $aCtrl[9][3] * $g_iDPI_ratio1, $aCtrl[9][4] * $g_iDPI_ratio1, $aCtrl[9][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region AVI - Label') GUICtrlSetFont(-1, $aCtrl[9][1] * $g_iDPI_ratio0) #EndRegion AVI #Region TAB $aCtrl[10][2] = 240 $aCtrl[10][3] = 0 $aCtrl[10][4] = 150 $aCtrl[10][5] = 70 $aCtrl[10][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[10][0] = GUICtrlCreateTab($aCtrl[10][2] * $g_iDPI_ratio1, $aCtrl[10][3] * $g_iDPI_ratio1, $aCtrl[10][4] * $g_iDPI_ratio1, $aCtrl[10][5] * $g_iDPI_ratio1) GUICtrlSetFont(-1, $aCtrl[10][1] * $g_iDPI_ratio0) $aCtrl[11][0] = GUICtrlCreateTabItem("One") GUICtrlSetTip(-1, '#Region TAB1') $aCtrl[12][2] = 250 $aCtrl[12][3] = 40 $aCtrl[12][4] = 130 $aCtrl[12][5] = 24 $aCtrl[12][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[12][0] = GUICtrlCreateLabel("Sample Tab with TabItems", $aCtrl[12][2] * $g_iDPI_ratio1, $aCtrl[12][3] * $g_iDPI_ratio1, $aCtrl[12][4] * $g_iDPI_ratio1, $aCtrl[12][5] * $g_iDPI_ratio1) GUICtrlSetFont(-1, $aCtrl[12][1] * $g_iDPI_ratio0) $aCtrl[13][0] = GUICtrlCreateTabItem("Two") GUICtrlSetTip(-1, '#Region TAB2') $aCtrl[14][0] = GUICtrlCreateTabItem("Three") GUICtrlSetTip(-1, '#Region TAB3') GUICtrlCreateTabItem("") #EndRegion TAB #Region COMBO $aCtrl[15][2] = 250 $aCtrl[15][3] = 80 $aCtrl[15][4] = 120 $aCtrl[15][5] = 100 $aCtrl[15][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[15][0] = GUICtrlCreateCombo("Sample Combo", $aCtrl[15][2] * $g_iDPI_ratio1, $aCtrl[15][3] * $g_iDPI_ratio1, $aCtrl[15][4] * $g_iDPI_ratio1, $aCtrl[15][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region COMBO') GUICtrlSetFont(-1, $aCtrl[15][1] * $g_iDPI_ratio0) #EndRegion COMBO #Region PROGRESS $aCtrl[16][2] = 60 $aCtrl[16][3] = 80 $aCtrl[16][4] = 150 $aCtrl[16][5] = 20 $aCtrl[16][0] = GUICtrlCreateProgress($aCtrl[16][2] * $g_iDPI_ratio1, $aCtrl[16][3] * $g_iDPI_ratio1, $aCtrl[16][4] * $g_iDPI_ratio1, $aCtrl[16][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region PROGRES') GUICtrlSetData(-1, 60) $aCtrl[17][2] = 5 $aCtrl[17][3] = 82 $aCtrl[17][4] = 50 $aCtrl[17][5] = 18 $aCtrl[17][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[17][0] = GUICtrlCreateLabel("Progress:", $aCtrl[17][2] * $g_iDPI_ratio1, $aCtrl[17][3] * $g_iDPI_ratio1, $aCtrl[17][4] * $g_iDPI_ratio1, $aCtrl[17][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region PROGRES - Label') GUICtrlSetFont(-1, $aCtrl[17][1] * $g_iDPI_ratio0) #EndRegion PROGRESS #Region EDIT $aCtrl[18][2] = 10 $aCtrl[18][3] = 110 $aCtrl[18][4] = 150 $aCtrl[18][5] = 70 $aCtrl[18][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[18][0] = GUICtrlCreateEdit(@CRLF & " Sample Edit Control", $aCtrl[18][2] * $g_iDPI_ratio1, $aCtrl[18][3] * $g_iDPI_ratio1, $aCtrl[18][4] * $g_iDPI_ratio1, $aCtrl[18][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region EDIT') GUICtrlSetFont(-1, $aCtrl[18][1] * $g_iDPI_ratio0) #EndRegion EDIT #Region LIST $aCtrl[19][2] = 5 $aCtrl[19][3] = 190 $aCtrl[19][4] = 100 $aCtrl[19][5] = 90 $aCtrl[19][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[19][0] = GUICtrlCreateList("", $aCtrl[19][2] * $g_iDPI_ratio1, $aCtrl[19][3] * $g_iDPI_ratio1, $aCtrl[19][4] * $g_iDPI_ratio1, $aCtrl[19][5] * $g_iDPI_ratio1) GUICtrlSetFont(-1, $aCtrl[19][1] * $g_iDPI_ratio0) GUICtrlSetTip(-1, '#Region LIST') GUICtrlSetData(-1, "A.Sample|B.List|C.Control|D.Here", "B.List") #EndRegion LIST #Region ICON $aCtrl[20][2] = 175 $aCtrl[20][3] = 120 $aCtrl[20][4] = 32 $aCtrl[20][5] = 32 $aCtrl[20][0] = GUICtrlCreateIcon("explorer.exe", 0, $aCtrl[20][2] * $g_iDPI_ratio1, $aCtrl[20][3] * $g_iDPI_ratio1, $aCtrl[20][4] * $g_iDPI_ratio1, $aCtrl[20][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region ICON') $aCtrl[21][2] = 180 $aCtrl[21][3] = 160 $aCtrl[21][4] = 50 $aCtrl[21][5] = 20 $aCtrl[21][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[21][0] = GUICtrlCreateLabel("Icon", $aCtrl[21][2] * $g_iDPI_ratio1, $aCtrl[21][3] * $g_iDPI_ratio1, $aCtrl[21][4] * $g_iDPI_ratio1, $aCtrl[21][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region ICON - Label') GUICtrlSetFont(-1, $aCtrl[21][1] * $g_iDPI_ratio0) #EndRegion ICON #Region LIST VIEW $aCtrl[22][2] = 110 $aCtrl[22][3] = 190 $aCtrl[22][4] = 110 $aCtrl[22][5] = 80 $aCtrl[22][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[22][0] = GUICtrlCreateListView("Sample|ListView|", $aCtrl[22][2] * $g_iDPI_ratio1, $aCtrl[22][3] * $g_iDPI_ratio1, $aCtrl[22][4] * $g_iDPI_ratio1, $aCtrl[22][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region LIST VIEW') GUICtrlSetFont(-1, $aCtrl[22][1] * $g_iDPI_ratio0) GUICtrlCreateListViewItem("A|One", $aCtrl[22][0]) GUICtrlCreateListViewItem("B|Two", $aCtrl[22][0]) GUICtrlCreateListViewItem("C|Three", $aCtrl[22][0]) #EndRegion LIST VIEW #Region GROUP WITH RADIO BUTTONS $aCtrl[23][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[23][0] = GUICtrlCreateGroup("Sample Group", 230 * $g_iDPI_ratio1, 120 * $g_iDPI_ratio1) GUICtrlSetFont(-1, $aCtrl[22][1] * $g_iDPI_ratio0) $aCtrl[24][2] = 250 $aCtrl[24][3] = 140 $aCtrl[24][4] = 80 $aCtrl[24][5] = 32 $aCtrl[24][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[24][0] = GUICtrlCreateRadio("Radio One", $aCtrl[24][2] * $g_iDPI_ratio1, $aCtrl[24][3] * $g_iDPI_ratio1, $aCtrl[24][4] * $g_iDPI_ratio1, $aCtrl[24][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region GROUP WITH RADIO BUTTONS- RADIO1') GUICtrlSetFont(-1, $aCtrl[24][1] * $g_iDPI_ratio0) GUICtrlSetState(-1, $GUI_CHECKED) $aCtrl[25][2] = 250 $aCtrl[25][3] = 165 $aCtrl[25][4] = 80 $aCtrl[25][5] = 32 $aCtrl[25][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[25][0] = GUICtrlCreateRadio("Radio Two", $aCtrl[25][2] * $g_iDPI_ratio1, $aCtrl[25][3] * $g_iDPI_ratio1, $aCtrl[25][4] * $g_iDPI_ratio1, $aCtrl[25][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region GROUP WITH RADIO BUTTONS- RADIO2') GUICtrlSetFont(-1, $aCtrl[25][1] * $g_iDPI_ratio0) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group #EndRegion GROUP WITH RADIO BUTTONS #Region UPDOWN $aCtrl[26][2] = 350 $aCtrl[26][3] = 113 $aCtrl[26][4] = 40 $aCtrl[26][5] = 12 $aCtrl[26][1] = 8 * $g_iDPI_ratio2 $aCtrl[26][0] = GUICtrlCreateLabel("UpDown", $aCtrl[26][2] * $g_iDPI_ratio1, $aCtrl[26][3] * $g_iDPI_ratio1, $aCtrl[26][4] * $g_iDPI_ratio1, $aCtrl[26][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region UPDOWN - Label') GUICtrlSetFont(-1, $aCtrl[26][1] * $g_iDPI_ratio0) $aCtrl[27][2] = 350 $aCtrl[27][3] = 130 $aCtrl[27][4] = 40 $aCtrl[27][5] = 20 $aCtrl[27][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[27][0] = GUICtrlCreateInput("42", $aCtrl[27][2] * $g_iDPI_ratio1, $aCtrl[27][3] * $g_iDPI_ratio1, $aCtrl[27][4] * $g_iDPI_ratio1, $aCtrl[27][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region UPDOWN - Input') GUICtrlSetFont(-1, $aCtrl[27][1] * $g_iDPI_ratio0) $aCtrl[28][0] = GUICtrlCreateUpdown(-1) GUICtrlSetTip(-1, '#Region UPDOWN - Updown') #EndRegion UPDOWN #Region LABEL $aCtrl[29][2] = 350 $aCtrl[29][3] = 165 $aCtrl[29][4] = 40 $aCtrl[29][5] = 40 $aCtrl[29][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[29][0] = GUICtrlCreateLabel("Green" & @CRLF & "Label", $aCtrl[29][2] * $g_iDPI_ratio1, $aCtrl[29][3] * $g_iDPI_ratio1, $aCtrl[29][4] * $g_iDPI_ratio1, $aCtrl[29][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region LABEL') GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlSetFont(-1, $aCtrl[29][1] * $g_iDPI_ratio0) #EndRegion LABEL #Region SLIDER $aCtrl[30][2] = 235 $aCtrl[30][3] = 215 $aCtrl[30][4] = 40 $aCtrl[30][5] = 16 $aCtrl[30][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[30][0] = GUICtrlCreateLabel("Slider:", $aCtrl[30][2] * $g_iDPI_ratio1, $aCtrl[30][3] * $g_iDPI_ratio1, $aCtrl[30][4] * $g_iDPI_ratio1, $aCtrl[30][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region SLIDER - Label') GUICtrlSetFont(-1, $aCtrl[30][1] * $g_iDPI_ratio0) $aCtrl[31][2] = 270 $aCtrl[31][3] = 210 $aCtrl[31][4] = 120 $aCtrl[31][5] = 30 $aCtrl[31][0] = GUICtrlCreateSlider($aCtrl[31][2] * $g_iDPI_ratio1, $aCtrl[31][3] * $g_iDPI_ratio1, $aCtrl[31][4] * $g_iDPI_ratio1, $aCtrl[31][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region SLIDER') GUICtrlSetData(-1, 30) #EndRegion SLIDER #Region INPUT $aCtrl[32][2] = 235 $aCtrl[32][3] = 255 $aCtrl[32][4] = 130 $aCtrl[32][5] = 20 $aCtrl[32][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[32][0] = GUICtrlCreateInput("Sample Input Box", $aCtrl[32][2] * $g_iDPI_ratio1, $aCtrl[32][3] * $g_iDPI_ratio1, $aCtrl[32][4] * $g_iDPI_ratio1, $aCtrl[32][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region INPUT') GUICtrlSetFont(-1, $aCtrl[32][1] * $g_iDPI_ratio0) #EndRegion INPUT #Region DATE $aCtrl[33][2] = 5 $aCtrl[33][3] = 280 $aCtrl[33][4] = 200 $aCtrl[33][5] = 20 $aCtrl[33][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[33][0] = GUICtrlCreateDate("", $aCtrl[33][2] * $g_iDPI_ratio1, $aCtrl[33][3] * $g_iDPI_ratio1, $aCtrl[33][4] * $g_iDPI_ratio1, $aCtrl[33][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region DATE') GUICtrlSetFont(-1, $aCtrl[33][1] * $g_iDPI_ratio0) $aCtrl[34][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[34][2] = 10 $aCtrl[34][3] = 305 $aCtrl[34][4] = 200 $aCtrl[34][5] = 20 $aCtrl[34][0] = GUICtrlCreateLabel("(Date control expands into a calendar)", $aCtrl[34][2] * $g_iDPI_ratio1, $aCtrl[34][3] * $g_iDPI_ratio1, $aCtrl[34][4] * $g_iDPI_ratio1, $aCtrl[34][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region DATE - Label') GUICtrlSetFont(-1, $aCtrl[34][1] * $g_iDPI_ratio0) #EndRegion DATE #Region BUTTON $aCtrl[35][2] = 10 $aCtrl[35][3] = 330 $aCtrl[35][4] = 100 $aCtrl[35][5] = 30 $aCtrl[35][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[35][0] = GUICtrlCreateButton("Sample Button", $aCtrl[35][2] * $g_iDPI_ratio1, $aCtrl[35][3] * $g_iDPI_ratio1, $aCtrl[35][4] * $g_iDPI_ratio1, $aCtrl[35][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region BUTTON') GUICtrlSetFont(-1, $aCtrl[35][1] * $g_iDPI_ratio0) #EndRegion BUTTON #Region CHECKBOX $aCtrl[36][2] = 130 $aCtrl[36][3] = 335 $aCtrl[36][4] = 80 $aCtrl[36][5] = 20 $aCtrl[36][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[36][0] = GUICtrlCreateCheckbox("Checkbox", $aCtrl[36][2] * $g_iDPI_ratio1, $aCtrl[36][3] * $g_iDPI_ratio1, $aCtrl[36][4] * $g_iDPI_ratio1, $aCtrl[36][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region CHECKBOX') GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetFont(-1, $aCtrl[36][1] * $g_iDPI_ratio0) #EndRegion CHECKBOX #Region TREEVIEW ONE $aCtrl[37][2] = 210 $aCtrl[37][3] = 290 $aCtrl[37][4] = 80 $aCtrl[37][5] = 80 $aCtrl[37][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[37][0] = GUICtrlCreateTreeView($aCtrl[37][2] * $g_iDPI_ratio1, $aCtrl[37][3] * $g_iDPI_ratio1, $aCtrl[37][4] * $g_iDPI_ratio1, $aCtrl[37][5] * $g_iDPI_ratio1) GUICtrlSetTip(-1, '#Region TREEVIEW ONE') GUICtrlSetFont(-1, $aCtrl[37][1] * $g_iDPI_ratio0) $aCtrl[38][0] = GUICtrlCreateTreeViewItem("TreeView", $aCtrl[37][0]) GUICtrlCreateTreeViewItem("Item1", $aCtrl[38][0]) GUICtrlCreateTreeViewItem("Item2", $aCtrl[38][0]) GUICtrlCreateTreeViewItem("Foo", -1) GUICtrlSetState($aCtrl[38][0], $GUI_EXPAND) #EndRegion TREEVIEW ONE #Region TREEVIEW TWO $aCtrl[39][2] = 295 $aCtrl[39][3] = 290 $aCtrl[39][4] = 103 $aCtrl[39][5] = 80 $aCtrl[39][1] = 8.5 * $g_iDPI_ratio2 $aCtrl[39][0] = GUICtrlCreateTreeView($aCtrl[39][2] * $g_iDPI_ratio1, $aCtrl[39][3] * $g_iDPI_ratio1, $aCtrl[39][4] * $g_iDPI_ratio1, $aCtrl[39][5] * $g_iDPI_ratio1, $TVS_CHECKBOXES) GUICtrlSetTip(-1, '#Region TREEVIEW TWO') GUICtrlSetFont(-1, $aCtrl[39][1] * $g_iDPI_ratio0) GUICtrlCreateTreeViewItem("TreeView", $aCtrl[39][0]) GUICtrlCreateTreeViewItem("With", $aCtrl[39][0]) GUICtrlCreateTreeViewItem("$TVS_CHECKBOXES", $aCtrl[39][0]) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlCreateTreeViewItem("Style", $aCtrl[39][0]) #EndRegion TREEVIEW TWO #Region GUI MESSAGE LOOP GUISetState(@SW_SHOW) ;~ If @OSBuild > 14392 Then Local $aStyles = GUIGetStyle($ahWnd[0][0]) _WinAPI_AdjustWindowRectExForDpi(200, $aStyles[0], BitXor($aStyles[1], $WS_EX_WINDOWEDGE), True) ;requires Win10 v1607+ / no server support ;~ EndIf GUIRegisterMsg($WM_DPICHANGED, "WM_DPICHANGED") ;requires Win 8.1+ / Server 2012 R2+ While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIRegisterMsg($WM_DPICHANGED, "") GUIDelete() #EndRegion GUI MESSAGE LOOP EndFunc ;==>_Example Func WM_DPICHANGED($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg ConsoleWrite("DPI change triggered" & @CRLF) Local $iDPI = _WinAPI_LoWord($wParam) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iDPI = ' & $iDPI & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Local $dpi_ratio1 = $iDPI / 96 Local $dpi_ratio2 = $dpi_ratio1 ^ -1 If @OSBuild > 14392 Then Local $aStyles = GUIGetStyle($ahWnd[0][0]) _WinAPI_AdjustWindowRectExForDpi($iDPI, $aStyles[0], BitXor($aStyles[1], $WS_EX_WINDOWEDGE, True)) ;requires Win10 v1607+ / no server support EndIf Local $tRECT = DllStructCreate($tagRECT, $lParam) Local $iX = $tRECT.left, $iY = $tRECT.top, $iW = $tRECT.right - $iX, $iH = $tRECT.bottom - $iY, $i _WinAPI_SetWindowPos($ahWnd[0][0], 0, $iX, $iY, $iW, $iH, BitOR($SWP_NOZORDER, $SWP_NOACTIVATE)) For $i = 0 To UBound($aCtrl) - 1 If $aCtrl[$i][1] Then GUICtrlSetFont($aCtrl[$i][0], $aCtrl[$i][1] * $dpi_ratio1) If $aCtrl[$i][4] Then GUICtrlSetPos($aCtrl[$i][0], $aCtrl[$i][2] * $dpi_ratio1, $aCtrl[$i][3] * $dpi_ratio1, $aCtrl[$i][4] * $dpi_ratio1, $aCtrl[$i][5] * $dpi_ratio1) Next _WinAPI_UpdateWindow($ahWnd[0][0]) Return 1 EndFunc ;==>WM_DPICHANGED I tested (not compiled!) with 200% on main screen and moved to 100% and back again. It looked good. Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
argumentum Posted August 2, 2023 Posted August 2, 2023 ..same, that in actuality looks more like this, size wise to my eyes ( did a 50% reduction on mspaint. The pic is uglier than reality ) Now, going back and forth, it gets to this: these pics are from the 4k @ 225% as primary monitor. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
argumentum Posted August 2, 2023 Posted August 2, 2023 ...the 100% looks like this: Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
argumentum Posted August 2, 2023 Posted August 2, 2023 (edited) this is a good idea for these testings and running the scripts from anywhere: Func AutoItExe_Path() ; AutoItExe_Path() & "\Examples\GUI\SampleAVI.avi" Return StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1) - 1) EndFunc Edit: the main PC I'm using has a portable setup. No RegRead() Edit2: This is better: Func ExamplesGUI_Path() ; ExamplesGUI_Path() & "SampleAVI.avi" Local Static $imgPath = IniRead(@AppDataDir & "\AutoIt_HiDpi_Testing\defaults.ini", "path", "ExamplesGUI", @CRLF) If $imgPath = @CRLF Then If @Compiled Then Return "" Else DirCreate(@AppDataDir & "\AutoIt_HiDpi_Testing") IniWrite(@AppDataDir & "\AutoIt_HiDpi_Testing\defaults.ini", "path", "ExamplesGUI", StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1)) & "Examples\GUI\") $imgPath = IniRead(@AppDataDir & "\AutoIt_HiDpi_Testing\defaults.ini", "path", "ExamplesGUI", @CRLF) EndIf EndIf Return $imgPath EndFunc and is better than writing to registry 🙄 Edited August 2, 2023 by argumentum thinking ahead Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
UEZ Posted August 2, 2023 Author Posted August 2, 2023 (edited) 100% at main monitor: 100% at main monitor to 200% second monitor: 100% at main monitor to 200% second monitor and back to 100% main monitor: 200% at main monitor: 200% at main monitor to 100% third monitor: 200% at main monitor to 100% third monitor and back to 200% main monitor: After the DPI change the title size of GUI stays at higher size!?!?! Tested on Win11 22H2. Edited August 2, 2023 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now