Okay, so that's not a problem. Maybe Lexikos set some different window styles. But if I call AdjustWindowRectEx with my own styles I still get different results.
Is this my PC acting up? I did a test without DPI scaling, and same result. Maybe adjustwindowrectexfordpi is the solution?
Code: Select all
#Requires AutoHotkey v1.1.33+
WS_VISIBLE := 0x10000000
WS_SYSMENU := 0x80000
WS_CHILD := 0x40000000
WS_EX_TOPMOST := 0x8
WS_EX_LAYERED := 0x80000
WS_TILEDWINDOW := 0xCF0000
WS_CAPTION := 0xC00000
WS_EX_STATICEDGE := 0x20000
WS_EX_WINDOWEDGE := 0x100
WS_SIZEBOX := 0x40000
WS_CLIPCHILDREN := 0x2000000
WS_POPUP := 0x80000000
WS_BORDER := 0x800000
WS_EX_TOOLWINDOW := 0x80
WS_CLIPSIBLINGS := 0x4000000
WS_EX_TRANSPARENT := 0x20
WS_EX_DLGMODALFRAME := 0x1
style := WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_CLIPCHILDREN | WS_POPUP | WS_CLIPSIBLINGS ;| WS_SIZEBOX
styleEx := WS_EX_TOPMOST | WS_EX_WINDOWEDGE | WS_EX_DLGMODALFRAME ;| WS_EX_STATICEDGE
VarSetCapacity(rect, 16)
NumPut(x := 0, rect, 0, "int")
NumPut(y := 0, rect, 4, "int")
NumPut(x2 := 1000, rect, 8, "int")
NumPut(y2 := 1000, rect, 12, "int")
MsgBox % "v1 (original)`n" x "`n" y "`n" x2 "`n" y2
DllCall("AdjustWindowRectEx", "ptr", &rect, "uint", style, "uint", 0, "uint", styleEx)
, x := NumGet(rect, 0, "int")
, y := NumGet(rect, 4, "int")
, w := NumGet(rect, 8, "int") - NumGet(rect, 0, "int")
, h := NumGet(rect, 12, "int") - NumGet(rect, 4, "int")
MsgBox % "v1 (modified)`n" x "`n" y "`n" w "`n" h
Code: Select all
#Requires AutoHotkey v2.0-beta.1+
WS_VISIBLE := 0x10000000
WS_SYSMENU := 0x80000
WS_CHILD := 0x40000000
WS_EX_TOPMOST := 0x8
WS_EX_LAYERED := 0x80000
WS_TILEDWINDOW := 0xCF0000
WS_CAPTION := 0xC00000
WS_EX_STATICEDGE := 0x20000
WS_EX_WINDOWEDGE := 0x100
WS_SIZEBOX := 0x40000
WS_CLIPCHILDREN := 0x2000000
WS_POPUP := 0x80000000
WS_BORDER := 0x800000
WS_EX_TOOLWINDOW := 0x80
WS_CLIPSIBLINGS := 0x4000000
WS_EX_TRANSPARENT := 0x20
WS_EX_DLGMODALFRAME := 0x1
style := WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_CLIPCHILDREN | WS_POPUP | WS_CLIPSIBLINGS ;| WS_SIZEBOX
styleEx := WS_EX_TOPMOST | WS_EX_WINDOWEDGE | WS_EX_DLGMODALFRAME ;| WS_EX_STATICEDGE
rect := Buffer(16)
NumPut("int", x := 0, rect, 0)
NumPut("int", y := 0, rect, 4)
NumPut("int", x2 := 1000, rect, 8)
NumPut("int", y2 := 1000, rect, 12)
MsgBox "v2 (original)`n" x "`n" y "`n" x2 "`n" y2
DllCall("AdjustWindowRectEx", "ptr", rect, "uint", style, "uint", 0, "uint", styleEx)
, x := NumGet(rect, 0, "int")
, y := NumGet(rect, 4, "int")
, w := NumGet(rect, 8, "int") - NumGet(rect, 0, "int")
, h := NumGet(rect, 12, "int") - NumGet(rect, 4, "int")
MsgBox "v2 (modified)`n" x "`n" y "`n" w "`n" h