Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
确定当前活动文本输入光标的屏幕坐标的最佳方法是什么?
我需要这个用于在线音译程序,以便在输入文本时向用户显示一些建议选项。
首先将线程输入附加到活动应用程序 ( AttachThreadInput)。然后用 获取插入符号的位置GetCaretPos。该位置在客户端坐标中,调用GetFocus以获得具有插入符号的窗口的句柄,然后将坐标转换为屏幕坐标ClientToScreen。最后通过再次调用来分离线程输入AttachThreadInput。
AttachThreadInput
GetCaretPos
GetFocus
ClientToScreen