Developers Jos Posted February 25, 2021 Developers Share Posted February 25, 2021 Why are you doing both GUIRegisterMsg() and a check in the message loop? Isn't the first enough? I don't understand yet how this solves the issue unless you recreate the GUI's? 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 More sharing options...
Developers Jos Posted February 25, 2021 Developers Share Posted February 25, 2021 (edited) This is the latest version of the script I have which has an UDF to do the changes for a list of GUI functions. There is still a lot of work to be done but maybe somebody wants to take it on... expandcollapse popup#cs ScriptName: HiDPI_Changes.au3 Description: Add the HiRes scaling to the GUI Functions #ce Global $Ifile = "" If $CMDLINE[0] Then $Ifile = $cmdline[1] While Not FileExists($Ifile) $Ifile = FileOpenDialog("File not found, select scriptfile to process :", Default, "AutoIt3 script (*.au3)", 1) If @error = 1 Then $rc = MsgBox(4100, "HiDPI process", "do you want to stop the process?") If $rc = 6 Then Exit EndIf ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Ifile = ' & $Ifile & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console WEnd Global $ofile = StringReplace($Ifile, ".au3", "_hidpi.au3") Global $iSource = FileRead($Ifile) ; Check if GDIPlus.au3 is already present Global $GDI_Include = StringRegExp($iSource, "(?i)[""'<]\s*?GDIPlus.au3\s*?[""'>]") ; Add the required part at the top of the output script Global $oSource = ';###################################################################################################' & @CRLF $oSource &= ';### Start Added by HiDPI_Changes Utility ###' & @CRLF If Not $GDI_Include Then $oSource &= '#include <GDIPlus.au3> ;### Added by Res_HiDpi' & @CRLF $oSource &= 'Global Const $_HiDPI_iScale = _HiDPI_IRatio()' & @CRLF $oSource &= ';???does this work==>GUIRegisterMsg(0x02E0, "_HiDPI_IRatio")' & @CRLF $oSource &= 'Func _HiDPI_IRatio()' & @CRLF $oSource &= ' _GDIPlus_Startup()' & @CRLF $oSource &= ' Local $hGfx = _GDIPlus_GraphicsCreateFromHWND(0)' & @CRLF $oSource &= ' If @error Then Return SetError(1, @extended, 1)' & @CRLF $oSource &= ' Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipGetDpiX", "handle", $hGfx, "float*", 0)' & @CRLF $oSource &= ' If @error Then Return SetError(2, @extended, 1)' & @CRLF $oSource &= ' Local $iDPI = $aResult[2]' & @CRLF $oSource &= ' _GDIPlus_GraphicsDispose($hGfx)' & @CRLF $oSource &= ' Return $iDPI / 96' & @CRLF $oSource &= 'EndFunc ;==>_HiDPI_IRatio' & @CRLF $oSource &= ';### End Added by HiDPI_Changes Utility ###' & @CRLF $oSource &= ';###################################################################################################' & @CRLF $oSource &= ';' & @CRLF ; Add the input script $oSource &= $iSource Insert_Scale("GUICreate",$oSource) Insert_Scale("GUICtrlCreateButton",$oSource) Insert_Scale("GUICtrlCreateCheckbox",$oSource) Insert_Scale("GUICtrlCreateCombo",$oSource) Insert_Scale("GUICtrlCreateEdit",$oSource) Insert_Scale("GUICtrlCreateInput",$oSource) Insert_Scale("GUICtrlCreateLabel",$oSource) ; Write outputfile FileDelete($ofile) FileWrite($ofile, $oSource) Func Insert_Scale($iFunction, ByRef $uSource) ; Statements with 5 parameters filled in $uSource = StringRegExpReplace($uSource, "(?i)(" & $iFunction & "\(['""\$].*?['""]?)(,\s*?\d*\s*?)(,\s*?\d*\s*?)(,\s*?\d*\s*?)(,\s*?\d*\s*?)(\)|,)", "$1$2*$_HiDPI_iScale$3*$_HiDPI_iScale$4*$_HiDPI_iScale$5*$_HiDPI_iScale$6") $uSource = StringRegExpReplace($uSource, "(?i)(" & $iFunction & "\(['""\$].*?['""]?)(,\s*?\d*\s*?)(,\s*?\d*\s*?)(,\s*?(?:default|-1)\s*?)(,\s*?\d*\s*?)(\)|,)", "$1$2*$_HiDPI_iScale$3*$_HiDPI_iScale$4$5*$_HiDPI_iScale$6") $uSource = StringRegExpReplace($uSource, "(?i)(" & $iFunction & "\(['""\$].*?['""]?)(,\s*?\d*\s*?)(,\s*?\d*\s*?)(,\s*?(?:default|-1)\s*?)(,\s*?(?:default|-1)\s*?)(\)|,)", "$1$2*$_HiDPI_iScale$3*$_HiDPI_iScale$4$5$6") ; Statements with 4 parameters filled in $uSource = StringRegExpReplace($uSource, "(?i)(" & $iFunction & "\(['""\$].*?['""]?)(,\s*?\d*\s*?)(,\s*?\d*\s*?)(,\s*?\d*\s*?)(\)|,)", "$1$2*$_HiDPI_iScale$3*$_HiDPI_iScale$4*$_HiDPI_iScale$5") $uSource = StringRegExpReplace($uSource, "(?i)(" & $iFunction & "\(['""\$].*?['""]?)(,\s*?\d*\s*?)(,\s*?\d*\s*?)(,\s*?(?:default|-1)\s*?)(\)|,)", "$1$2*$_HiDPI_iScale$3*$_HiDPI_iScale$4*$5") ; Statements with 3 parameters filled in $uSource = StringRegExpReplace($uSource, "(?i)(" & $iFunction & "\(['""\$].*?['""]?)(,\s*?\d*\s*?)(,\s*?\d*\s*?)(\)|,)", "$1$2*$_HiDPI_iScale$3*$_HiDPI_iScale$4") ; Statements with 2 parameters filled in $uSource = StringRegExpReplace($uSource, "(?i)(" & $iFunction & "\(['""\$].*?['""]?)(,\s*?\d*\s*?)(\)|,)", "$1$2*$_HiDPI_iScale$3") Return EndFunc Edited February 25, 2021 by Jos simplercoder000 1 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 More sharing options...
Shark007 Posted February 25, 2021 Author Share Posted February 25, 2021 5 minutes ago, Jos said: Why are you doing both GUIRegisterMsg() and a check in the message loop? Isn't the first enough? I don't understand yet how this solves the issue unless you recreate the GUI's? Jos As previously stated, I am not the best @ scripting. I saw it done like this somewhere here on the forum and copied what I had seen. I have several messages handled like this. Guess I need to do some testing to reduce that to a single instance. Thanks for the heads up on that. I think when you drag from one monitor to the other, the GUI is redrawn. Must be the same for when you change the DPI on a single monitor because I know for a fact my GUI's had issues if it was open when you changed the DPI. Since adding GUIRegisterMsg the GUI always looks good even if you change the DPI. Link to comment Share on other sites More sharing options...
Developers Jos Posted February 25, 2021 Developers Share Posted February 25, 2021 The reason for asking is that I was thinking how that could be made generic. The GUIRegisterMsg() is easy to implement in an conversion script while the message loop test is much more difficult give the other Gui options (event mode). As to the DPI change when moving to another monitor: When you created the GUI and all GUIControls, only at that time the $iScale is used so I can't see yet how implementing that Message calling DPIRatio() would do anything....but maybe I am missing something here. 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 More sharing options...
Shark007 Posted February 25, 2021 Author Share Posted February 25, 2021 (edited) 34 minutes ago, Jos said: Why are you doing both GUIRegisterMsg() and a check in the message loop? Isn't the first enough? Jos A bit of an update here after testing. 1st I commented the GUIRegisterMsg's and all of my function(s) stopped working. Then I removed those comments and commented the occurrences in the While loop instead and everything worked. So removing them from the loop is the way for me. About why it works after capturing the WM_DPICHANGED message and executing the DPIRatio Function, I have no answer other than what my test results have shown me. I intend to do more testing. If I discover anything new, I will bring it here. Edited February 25, 2021 by Shark007 Link to comment Share on other sites More sharing options...
Shark007 Posted February 25, 2021 Author Share Posted February 25, 2021 (edited) So, back after more testing. I cannot re-create what I thought I saw earlier as 'working'. In fact the dragged GUI, upon subsequently opening it on the secondary monitor after closing it on there (I track positioning and keep it in an ini file) does not get the dpi of the secondary monitor at all and is obviously still using the DPI of the Primary monitor. It is quite possible though, that these skewed results are from me playing with the Primary monitors DPI without signing out of Windows and back in. Windows does warn you that things mat not be correct until you sign out and back in. In earlier versions of Windows, you had to reboot. Back to the drawing board for me. 😞 Edited February 25, 2021 by Shark007 Link to comment Share on other sites More sharing options...
Shark007 Posted February 25, 2021 Author Share Posted February 25, 2021 (edited) 1 hour ago, Jos said: As to the DPI change when moving to another monitor: When you created the GUI and all GUIControls, only at that time the $iScale is used so I can't see yet how implementing that Message calling DPIRatio() would do anything....but maybe I am missing something here. You are correct. Getting that message and calling the DPIRatio function is not giving me anything. The GUI would need to be re-created. Back to research to figure out how to get the DPI of the current monitor instead of the Primary. I have some idea's, nothing simple though. Edited February 25, 2021 by Shark007 Link to comment Share on other sites More sharing options...
Developers Jos Posted February 25, 2021 Developers Share Posted February 25, 2021 1 hour ago, Shark007 said: A bit of an update here after testing. 1st I commented the GUIRegisterMsg's and all of my function(s) stopped working. Then I removed those comments and commented the occurrences in the While loop instead and everything worked. So removing them from the loop is the way for me. 1 minute ago, Shark007 said: Getting that message and calling the DPIRatio function is not giving me anything. The GUI would need to be re-created. That makes sense to me. You will have to do a WinMove()/GUICtrlSetPos() for each object to position and resize them. 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 More sharing options...
Shark007 Posted February 25, 2021 Author Share Posted February 25, 2021 (edited) About Screen changes: I came up with a scenario that works for me by using my already in use, ini file. I picked up a few tidbits from you, and added some of my own Func DPIRatio() _GDIPlus_Startup() Local $hGfx = _GDIPlus_GraphicsCreateFromHWND(0) If @error Then Return SetError(1, @extended, 1) Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipGetDpiX", "handle", $hGfx, "float*", 0) If @error Then Return SetError(2, @extended, 1) Local $iDPI = $aResult[2] _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_Shutdown() If IniRead($Ini, 'Current', 'DPI', '') = @error Then IniWrite($Ini, 'Current', 'DPI', $iDPI) If IniRead($Ini, 'Current', 'DPI', '') <> $iDPI Then Return IniRead($Ini, 'Current', 'DPI', '') / 96 Else Return $iDPI / 96 EndIf EndFunc and I learned that when receiving the message from GUIRegisterMsg(0x02E0, 'DPI') It detects and reports the scaling factor of that new screen so I send it to this new function Func DPI($SetApp, $WM_DPICHANGED, $WParam) If _WinAPI_HiWord($wParam) <> IniRead($Ini, 'Current', 'DPI', 96) Then IniWrite($Ini, 'Current', 'DPI', _WinAPI_HiWord($wParam)) MsgBox(262160, 'DPI change detected', 'The GUI is going to restart...', 10) _ScriptRestart() EndIf EndFunc and my restart script is this Func _ScriptRestart() Run(@ScriptFullPath) Exit EndFunc Edited February 27, 2021 by Shark007 Link to comment Share on other sites More sharing options...
Shark007 Posted February 26, 2021 Author Share Posted February 26, 2021 (edited) 11 hours ago, Jos said: This is the latest version of the script I have which has an UDF to do the changes for a list of GUI functions. There is still a lot of work to be done but maybe somebody wants to take it on... I did a quick test of what you have so far without making any attempt at modifying it. I used one of my scripts as a test which contained 466 iterations of $iScale which I stripped out for the test. After running your script on it, it had returned 287 iterations. EDIT, I added these 4 Insert_Scale("GUICtrlCreateRadio",$oSource) Insert_Scale("SplashTextOn",$oSource) - ignore this one as they often include math for proper positioning Insert_Scale("GUICtrlCreatePic",$oSource) Insert_Scale("GUICtrlCreateGroup",$oSource) and am up to 448 of 466 The ones that are left are private controls and a couple GUICtrlCreatePic(StringReplace iterations. That's pretty complete Jos. Damn fine work on your part. I'll follow up with some functionality tests soon. Edited February 26, 2021 by Shark007 Link to comment Share on other sites More sharing options...
Shark007 Posted February 26, 2021 Author Share Posted February 26, 2021 (edited) When trying functionality , I keep getting errors about GDIPlus variables not being declared. I had to change the positioning of the GDIPlus stuff to where I had it originally and put in the handle for my App where you had placed 0 ^^^ this needs more testing ^^^ I now have a good looking, functional App using PerMonitorV2 Awareness. I'd also like to mention, I love the Tidy feature! About this - ;???does this work==>GUIRegisterMsg(0x02E0, "_HiDPI_IRatio") The GDIPlus function only works on the Primary monitor. Func DPI($SetApp, $WM_DPICHANGED, $WParam) ; this gets the dpi from the subsequent monitor If _WinAPI_HiWord($wParam) <> IniRead($Ini, 'Current', 'DPI', 96) Then IniWrite($Ini, 'Current', 'DPI', _WinAPI_HiWord($wParam)) MsgBox(262160, 'DPI change detected', 'The GUI is going to restart...', 10) _ScriptRestart() EndIf EndFunc Is there a way to stop forum line spacing? I hate that. Edited February 26, 2021 by Shark007 Link to comment Share on other sites More sharing options...
InnI Posted February 26, 2021 Share Posted February 26, 2021 13 hours ago, Shark007 said: how to get the DPI of the current monitor instead of the Primary Link to comment Share on other sites More sharing options...
Developers Jos Posted February 26, 2021 Developers Share Posted February 26, 2021 7 hours ago, Shark007 said: I did a quick test of what you have so far without making any attempt at modifying it. That script is far from being complete, but just wanted to share what one approach to this challenge could be. 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 More sharing options...
Shark007 Posted March 3, 2021 Author Share Posted March 3, 2021 On 2/23/2021 at 9:20 AM, Shark007 said: I have done extensive, . . . Replace the entire DPI section with the following... My testing continues and I am back to tell you I was wrong to suggest replacing the entire section. I was looking for certain DPI behavior from the absolute latest beta version on Windows 10. The only way I was able to achieve it was to use the following code. FileWriteLine($hTempFile2, ' <asmv3:windowsSettings>') FileWriteLine($hTempFile2, ' <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True</dpiAware>') FileWriteLine($hTempFile2, ' </asmv3:windowsSettings>') Link to comment Share on other sites More sharing options...
simplercoder000 Posted February 13 Share Posted February 13 Hi, First of all I hope this forum doesn't forbidden pumping old threads. I have checked the value returned by '_HiDPI_IRatioGDIPlus' function and the value is '1' but when querying from the registry key the returned value are '1.5' so both values are little bit different. This little bit different are leading my GUI controls to not sorted well. This thread here contains a way to get current value of DPI used on the system via a registry key: Also please note that the High DPI won't be enabled unless it's been requested to be enabled by the user: So adding these two lines into my GUI script, after Jos's magic regex script has finished their work I can finally get my auto patched script working with High DPI feature ! If @OSVersion = 'WIN_10' Then DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext" , "HWND", "DPI_AWARENESS_CONTEXT" -2) If @OSVersion = 'WIN_81' Or 'WIN_7' Then DllCall("User32.dll", "bool", "SetProcessDPIAware") Please note that I have only tested this in Windows 7 x64 argumentum 1 Link to comment Share on other sites More sharing options...
argumentum Posted February 13 Share Posted February 13 would you paste a running GUI ( small ) sample code ?, thanks. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
argumentum Posted February 13 Share Posted February 13 goodness!, I forgot. Try this ( https://www.autoitscript.com/forum/topic/210604-tester-needed/#comment-1522028 ) Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
simplercoder000 Posted February 13 Share Posted February 13 16 minutes ago, argumentum said: would you paste a running GUI ( small ) sample code ?, thanks. Yes, sure Here's my previous example located here after patching it with HiDPI_Changes.au3 + adding two lines to enable the High DPI awareness: expandcollapse popup;################################################################################################### ;### Start Added by HiDPI_Changes Utility ### #include <GDIPlus.au3> ;### Added by Res_HiDpi Global Const $_HiDPI_iScale = _HiDPI_IRatio() If @OSVersion = 'WIN_10' Then DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext" , "HWND", "DPI_AWARENESS_CONTEXT" -2) If @OSVersion = 'WIN_81' Or 'WIN_7' Then DllCall("User32.dll", "bool", "SetProcessDPIAware") MsgBox(0,'Returned DPI value', $_HiDPI_iScale) ;???does this work==>GUIRegisterMsg(0x02E0, "_HiDPI_IRatio") Func _HiDPI_IRatio() _GDIPlus_Startup() Local $hGfx = _GDIPlus_GraphicsCreateFromHWND(0) If @error Then Return SetError(1, @extended, 1) Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipGetDpiX", "handle", $hGfx, "float*", 0) If @error Then Return SetError(2, @extended, 1) Local $iDPI = $aResult[2] _GDIPlus_GraphicsDispose($hGfx) Return $iDPI / 96 EndFunc ;==>_HiDPI_IRatio ;### End Added by HiDPI_Changes Utility ### ;################################################################################################### ; #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 220*$_HiDPI_iScale, 172*$_HiDPI_iScale, 195*$_HiDPI_iScale, 124*$_HiDPI_iScale) $Button1 = GUICtrlCreateButton("Button1", 32*$_HiDPI_iScale, 112*$_HiDPI_iScale, 75*$_HiDPI_iScale, 33*$_HiDPI_iScale) $Button2 = GUICtrlCreateButton("Button2", 114*$_HiDPI_iScale, 112*$_HiDPI_iScale, 75*$_HiDPI_iScale, 33*$_HiDPI_iScale) $Input1 = GUICtrlCreateInput("Input1", 48*$_HiDPI_iScale, 72*$_HiDPI_iScale, 121*$_HiDPI_iScale, 21*$_HiDPI_iScale) $Label1 = GUICtrlCreateLabel("Autoit are awesome !", 64*$_HiDPI_iScale, 24*$_HiDPI_iScale, 103*$_HiDPI_iScale, 17*$_HiDPI_iScale) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd argumentum 1 Link to comment Share on other sites More sharing options...
simplercoder000 Posted February 13 Share Posted February 13 I'm really not sure which method is better to get the current DPI value, but here's an modified version of HiDPI_Changes UDF of @Jos expandcollapse popup#cs ScriptName: HiDPI_Changes.au3 Description: Add the HiRes scaling to the GUI Functions #ce Global $Ifile = "" If $CMDLINE[0] Then $Ifile = $cmdline[1] While Not FileExists($Ifile) $Ifile = FileOpenDialog("File not found, select scriptfile to process :", Default, "AutoIt3 script (*.au3)", 1) If @error = 1 Then $rc = MsgBox(4100, "HiDPI process", "do you want to stop the process?") If $rc = 6 Then Exit EndIf WEnd Global $ofile = StringReplace($Ifile, ".au3", "_hidpi.au3") Global $iSource = FileRead($Ifile) ; Check if GDIPlus.au3 is already present Global $GDI_Include = StringRegExp($iSource, "(?i)[""'<]\s*?GDIPlus.au3\s*?[""'>]") ; Add the required part at the top of the output script Global $oSource = ';###################################################################################################' & @CRLF $oSource &= ';### Start Added by HiDPI_Changes Utility ###' & @CRLF If Not $GDI_Include Then $oSource &= '#include <GDIPlus.au3> ;### Added by Res_HiDpi' & @CRLF $oSource &= 'Global Const $_HiDPI_iScale = _HiDPI_IRatio()' & @CRLF $oSource &= ' ;MsgBox(0, ''Returned DPI value'', $_HiDPI_iScale); Debug' & @CRLF $oSource &= ';???does this work==>GUIRegisterMsg(0x02E0, "_HiDPI_IRatio")' & @CRLF $oSource &= 'Func _HiDPI_IRatio()' & @CRLF $oSource &= ' If @OSVersion = ''WIN_10'' Then' & @CRLF $oSource &= ' DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext" , "HWND", "DPI_AWARENESS_CONTEXT" -2)' & @CRLF $oSource &= ' ElseIf @OSVersion = ''WIN_81'' Or ''WIN_7'' Then' & @CRLF $oSource &= ' DllCall("User32.dll", "bool", "SetProcessDPIAware")' & @CRLF $oSource &= ' EndIf' & @CRLF $oSource &= ' Local $Scale = RegRead("HKCU\Control Panel\Desktop\WindowMetrics", "AppliedDPI") / 96' & @CRLF $oSource &= ' Return $Scale' & @CRLF $oSource &= 'EndFunc ;==>_HiDPI_IRatio' & @CRLF $oSource &= ';### End Added by HiDPI_Changes Utility ###' & @CRLF $oSource &= ';###################################################################################################' & @CRLF $oSource &= ';' & @CRLF ; Add the input script $oSource &= $iSource Insert_Scale("GUICreate",$oSource) Insert_Scale("GUICtrlCreateButton",$oSource) Insert_Scale("GUICtrlCreateCheckbox",$oSource) Insert_Scale("GUICtrlCreateCombo",$oSource) Insert_Scale("GUICtrlCreateEdit",$oSource) Insert_Scale("GUICtrlCreateInput",$oSource) Insert_Scale("GUICtrlCreateLabel",$oSource) ; Write outputfile FileDelete($ofile) FileWrite($ofile, $oSource) Func Insert_Scale($iFunction, ByRef $uSource) ; Statements with 5 parameters filled in $uSource = StringRegExpReplace($uSource, "(?i)(" & $iFunction & "\(['""\$].*?['""]?)(,\s*?\d*\s*?)(,\s*?\d*\s*?)(,\s*?\d*\s*?)(,\s*?\d*\s*?)(\)|,)", "$1$2*$_HiDPI_iScale$3*$_HiDPI_iScale$4*$_HiDPI_iScale$5*$_HiDPI_iScale$6") $uSource = StringRegExpReplace($uSource, "(?i)(" & $iFunction & "\(['""\$].*?['""]?)(,\s*?\d*\s*?)(,\s*?\d*\s*?)(,\s*?(?:default|-1)\s*?)(,\s*?\d*\s*?)(\)|,)", "$1$2*$_HiDPI_iScale$3*$_HiDPI_iScale$4$5*$_HiDPI_iScale$6") $uSource = StringRegExpReplace($uSource, "(?i)(" & $iFunction & "\(['""\$].*?['""]?)(,\s*?\d*\s*?)(,\s*?\d*\s*?)(,\s*?(?:default|-1)\s*?)(,\s*?(?:default|-1)\s*?)(\)|,)", "$1$2*$_HiDPI_iScale$3*$_HiDPI_iScale$4$5$6") ; Statements with 4 parameters filled in $uSource = StringRegExpReplace($uSource, "(?i)(" & $iFunction & "\(['""\$].*?['""]?)(,\s*?\d*\s*?)(,\s*?\d*\s*?)(,\s*?\d*\s*?)(\)|,)", "$1$2*$_HiDPI_iScale$3*$_HiDPI_iScale$4*$_HiDPI_iScale$5") $uSource = StringRegExpReplace($uSource, "(?i)(" & $iFunction & "\(['""\$].*?['""]?)(,\s*?\d*\s*?)(,\s*?\d*\s*?)(,\s*?(?:default|-1)\s*?)(\)|,)", "$1$2*$_HiDPI_iScale$3*$_HiDPI_iScale$4*$5") ; Statements with 3 parameters filled in $uSource = StringRegExpReplace($uSource, "(?i)(" & $iFunction & "\(['""\$].*?['""]?)(,\s*?\d*\s*?)(,\s*?\d*\s*?)(\)|,)", "$1$2*$_HiDPI_iScale$3*$_HiDPI_iScale$4") ; Statements with 2 parameters filled in $uSource = StringRegExpReplace($uSource, "(?i)(" & $iFunction & "\(['""\$].*?['""]?)(,\s*?\d*\s*?)(\)|,)", "$1$2*$_HiDPI_iScale$3") Return EndFunc The UDF itself doesn't supports High DPI feature and I haven't add it just in case this doesn't work well. Please note that I have only tested this in Windows 7, so someone please confirm If this are really working on Windows 10/11 Link to comment Share on other sites More sharing options...
simplercoder000 Posted February 13 Share Posted February 13 Ops, I have removed the debug console line by mistake but that's shouldn't cause any problem ;). Link to comment Share on other sites More sharing options...
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