I’m finding that GuiGetPos() is returning incorrect values in v2.0.11 (and correct values in v2.0-a122).
======
v2.0.11
======
Code: Select all
/*
v2.0.11
*/
; DPIScaleEnabled =======================================================================================
MyGui_DPIScaleEnabled := Gui( Options := "+AlwaysOnTop +Owner", Title := "DPIScaleEnabled")
MyGui_DPIScaleEnabled.Show("x50 y50 w400 h150") ; W and H are client area (the client area excludes the window's borders, title bar, and menu bar).
MyGui_DPIScaleEnabled.Add("Text",, "A_AhkVersion: " A_AhkVersion)
MyGui_DPIScaleEnabled.Add("Text",, "A_ScreenDPI: " A_ScreenDPI)
MyGui_DPIScaleEnabled.GetPos( ; Per Documentation: applies DPI scaling to Width and Height (unless the -DPIScale option was used).
&X_DPIScaleEnabled := "",
&Y_DPIScaleEnabled := "",
&Width_DPIScaleEnabled := "",
&Height_DPIScaleEnabled := ""
)
MyGui_DPIScaleEnabled.Add("Text",, "GetPos(): X" X_DPIScaleEnabled " Y" Y_DPIScaleEnabled " W" Width_DPIScaleEnabled " H" Height_DPIScaleEnabled)
WinGetPos(
&OutX_DPIScaleEnabled := "",
&OutY_DPIScaleEnabled := "",
&OutWidth_DPIScaleEnabled := "",
&OutHeight_DPIScaleEnabled := "",
WinTitle := MyGui_DPIScaleEnabled
)
MyGui_DPIScaleEnabled.Add("Text",, "WinGetPos(): X" OutX_DPIScaleEnabled " Y" OutY_DPIScaleEnabled " W" OutWidth_DPIScaleEnabled " H" OutHeight_DPIScaleEnabled)
; DPIScaleDisabled =======================================================================================
MyGui_DPIScaleDisabled := Gui( Options := "+AlwaysOnTop +Owner -DPIScale", Title := "DPIScaleDisabled")
MyGui_DPIScaleDisabled.Show("x850 y50 w400 h150")
MyGui_DPIScaleDisabled.Add("Text",, "A_AhkVersion: " A_AhkVersion)
MyGui_DPIScaleDisabled.Add("Text",, "A_ScreenDPI: " A_ScreenDPI)
MyGui_DPIScaleDisabled.GetPos( ; Per Documentation: applies DPI scaling to Width and Height (unless the -DPIScale option was used).
&X_DPIScaleDisabled := "",
&Y_DPIScaleDisabled := "",
&Width_DPIScaleDisabled := "",
&Height_DPIScaleDisabled := ""
)
MyGui_DPIScaleDisabled.Add("Text",, "GetPos(): X" X_DPIScaleDisabled " Y" Y_DPIScaleDisabled " W" Width_DPIScaleDisabled " H" Height_DPIScaleDisabled)
hwnd2 := MyGui_DPIScaleDisabled.Hwnd
WinGetPos(
&OutX_DPIScaleDisabled := "",
&OutY_DPIScaleDisabled := "",
&OutWidth_DPIScaleDisabled := "",
&OutHeight_DPIScaleDisabled := "",
WinTitle := MyGui_DPIScaleDisabled
)
MyGui_DPIScaleDisabled.Add("Text",, "WinGetPos(): X" OutX_DPIScaleDisabled " Y" OutY_DPIScaleDisabled " W" OutWidth_DPIScaleDisabled " H" OutHeight_DPIScaleDisabled)
pause
========
v2.0-a122
========
Code: Select all
/*
v2.0-a122
*/
; DPIScaleEnabled =======================================================================================
MyGui_DPIScaleEnabled := Gui.New( Options := "+AlwaysOnTop +Owner", Title := "DPIScaleEnabled")
MyGui_DPIScaleEnabled.Show("x50 y50 w400 h150") ; W and H are client area (the client area excludes the window's borders, title bar, and menu bar).
MyGui_DPIScaleEnabled.Add("Text",, "A_AhkVersion: " A_AhkVersion)
MyGui_DPIScaleEnabled.Add("Text",, "A_ScreenDPI: " A_ScreenDPI)
MyGui_DPIScaleEnabled.GetPos( ; Per Documentation: applies DPI scaling to Width and Height (unless the -DPIScale option was used).
X_DPIScaleEnabled := "",
Y_DPIScaleEnabled := "",
Width_DPIScaleEnabled := "",
Height_DPIScaleEnabled := ""
)
MyGui_DPIScaleEnabled.Add("Text",, "GetPos(): X" X_DPIScaleEnabled " Y" Y_DPIScaleEnabled " W" Width_DPIScaleEnabled " H" Height_DPIScaleEnabled)
WinGetPos(
OutX_DPIScaleEnabled := "",
OutY_DPIScaleEnabled := "",
OutWidth_DPIScaleEnabled := "",
OutHeight_DPIScaleEnabled := "",
WinTitle := MyGui_DPIScaleEnabled
)
MyGui_DPIScaleEnabled.Add("Text",, "WinGetPos(): X" OutX_DPIScaleEnabled " Y" OutY_DPIScaleEnabled " W" OutWidth_DPIScaleEnabled " H" OutHeight_DPIScaleEnabled)
; DPIScaleDisabled =======================================================================================
MyGui_DPIScaleDisabled := Gui.New( Options := "+AlwaysOnTop +Owner -DPIScale", Title := "DPIScaleDisabled")
MyGui_DPIScaleDisabled.Show("x850 y50 w400 h150")
MyGui_DPIScaleDisabled.Add("Text",, "A_AhkVersion: " A_AhkVersion)
MyGui_DPIScaleDisabled.Add("Text",, "A_ScreenDPI: " A_ScreenDPI)
MyGui_DPIScaleDisabled.GetPos( ; Per Documentation: applies DPI scaling to Width and Height (unless the -DPIScale option was used).
X_DPIScaleDisabled := "",
Y_DPIScaleDisabled := "",
Width_DPIScaleDisabled := "",
Height_DPIScaleDisabled := ""
)
MyGui_DPIScaleDisabled.Add("Text",, "GetPos(): X" X_DPIScaleDisabled " Y" Y_DPIScaleDisabled " W" Width_DPIScaleDisabled " H" Height_DPIScaleDisabled)
hwnd2 := MyGui_DPIScaleDisabled.Hwnd
WinGetPos(
OutX_DPIScaleDisabled := "",
OutY_DPIScaleDisabled := "",
OutWidth_DPIScaleDisabled := "",
OutHeight_DPIScaleDisabled := "",
WinTitle := MyGui_DPIScaleDisabled
)
MyGui_DPIScaleDisabled.Add("Text",, "WinGetPos(): X" OutX_DPIScaleDisabled " Y" OutY_DPIScaleDisabled " W" OutWidth_DPIScaleDisabled " H" OutHeight_DPIScaleDisabled)
pause