F1:: CoordMode, Caret, Screen GetCaretPos(x, y) MsgBox, % "MY :`t" x ", " y "`nAHK:`t" A_CaretX ", " A_CaretY return GetCaretPos(ByRef x, ByRef y) { static Size:=8+(A_PtrSize*6)+16, hwndCaret:=8+A_PtrSize*5 Static CaretX:=8+(A_PtrSize*6), CaretY:=CaretX+4 VarSetCapacity(Info, Size, 0), NumPut(Size, Info, "Int") DllCall("GetGUIThreadInfo", "UInt", 0, "Ptr", &Info), x:=y:="" if !(HWND:=NumGet(Info, hwndCaret, "Ptr")) return, 0 x:=NumGet(Info, CaretX, "Int"), y:=NumGet(Info, CaretY, "Int") VarSetCapacity(pt, 8), NumPut(y, NumPut(x, pt, "Int"), "Int") DllCall("ClientToScreen", "Ptr", HWND, "Ptr", &pt) x:=NumGet(pt, 0, "Int"), y:=NumGet(pt, 4, "Int") return, 1 } /* typedef struct tagGUITHREADINFO { DWORD cbSize; //4 DWORD flags; //4 HWND hwndActive; //A_PtrSize HWND hwndFocus; //A_PtrSize HWND hwndCapture; //A_PtrSize HWND hwndMenuOwner; //A_PtrSize HWND hwndMoveSize; //A_PtrSize HWND hwndCaret; //A_PtrSize RECT rcCaret; //16 } GUITHREADINFO */
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。