本帖最后由 jj119120 于 2011-10-15 03:06 编辑
回复 6# 魔导
我可算不上前辈 也就比你早注册几天 给你个例子 你要是能看懂 相对坐标的问题就好解决了#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 1281, 721, 293, 138)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_PRIMARYDOWN
$size = WinGetPos("[active]")
;MsgBox(0, "活动窗口状态 (X坐标,Y坐标,宽度,高度):", $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3])
$pos = MouseGetPos()
;MsgBox(0, "鼠标 x,y:", $pos[0] & "," & $pos[1])
$X = $pos[0] - $size[0]
$Y = $pos[1] - $size[1]
MsgBox(0, "鼠标 x,y:", $X & "," & $Y)
EndSwitch
WEnd
在窗口内任意位置点击鼠标左键 显示在当前窗口的相对位置 |