首页 > 解决方案 > WinGetPos 返回负坐标

问题描述

我正在尝试获取窗口的位置和大小。但是,我看到在任何全屏窗口上我的 X 和 Y 都为 -9。

WinGetTitle, WT, A
WinGet, WID, ID, A
WinGetPos, X, Y, Width, Height, %WT%
ListVars
WinWaitActive ahk_class AutoHotkey
ControlSetText Edit1, [Title]`r`n%WT%`r`n[ID]`r`n%WID%`r`n[Dimensions]`r`nX: %X%`r`nY: %Y%`r`nWidth: %Width%`r`nHeight: %Height%
WinWaitClose

上述代码的输出是:

[Title]
Stuff.ahk - SciTE4AutoHotkey
[ID]
0x4e079a
[Dimensions]
X: -9
Y: -9
Width: 1938
Height: 1048

只是我的决心导致了这种情况吗?当我使用窗口间谍时,我可以清楚地看到窗口的左上角是绝对的 0,0 或窗口的 9,9。

知道为什么会这样吗?

标签: autohotkey

解决方案


客户区是从窗口区域到屏幕的 0x0 的 -9 xy。这就是它的样子。


推荐阅读