G
golden_future
Unregistered / Unconfirmed
GUEST, unregistred user!
以下为我的代码:<br>function GetCaretScreenPos() : TPoint;<br>var<br> aHandle : THandle;<br> aThread : THandle;<br> aFocus : THandle;<br> aFocusRect : TRect;<br> aCaretPos : TPoint;<br> i : Integer;<br> aRes : LongBool;<br>begin<br> aHandle := GetForegroundWindow();<br> aThread:=GetWindowThreadProcessId(aHandle);<br> AttachThreadInput(GetCurrentThreadId,AThread,True);<br> SetActiveWindow(aHandle);<br> aFocus := GetFocus;<br> GetCaretPos(aCaretPos) then<br> windows.ClientToScreen(aFocus, aCaretPos);<br> AttachThreadInput(GetCurrentThreadId,AThread,False);<br> <br> Result.X := aCaretPos.X;<br> Result.Y := aCaretPos.Y;<br>end;<br><br>在其它所有窗口(edit combobox, richedit)中都可以, 只有 Word 中不可用不知为什么,<br>我不想用VBA 来实现.