如何消除 Microsoft Word 的焦点?文档窗口?

发布于 2024-08-15 09:31:22 字数 304 浏览 12 评论 0原文

我正在Delphi中开发一个Word插件,在任务窗格上我放置了一个虚拟树视图,在虚拟树视图的OnFocus事件中我调用Word通过方法ActiveDocument.Range.InsertFile将文件插入到当前Word文档中,但是这个操作会将输入焦点放回 Word 文档窗口,因此最后在此事件处理程序中我调用 TreeView.SetFocus 将焦点设置回树视图,除了 Word 文档窗口仍然显示不闪烁的插入符号外,此操作有效。

我尝试将 WM_KILLFOCUS Windows 消息发送到 Word 文档窗口的句柄,但没有成功。有什么提示吗?先感谢您!

I'm developing a Word addin in Delphi, on a task pane I put a Virtual treeview, in the OnFocus event of the Virtual Treeview I call Word to insert a file into the current Word document via method ActiveDocument.Range.InsertFile, but this operation will put the input focus back to the Word document window, so finally in this event handler I call TreeView.SetFocus to set the focus back to the treeview, this works except that the Word document window still has a unblinking caret shown.

I tried sending the WM_KILLFOCUS windows message to the handle of the Word document window but no luck. Any hints? Thank you in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

那片花海 2024-08-22 09:31:22

您可以尝试调用Application.BringToFront或Application.MainForm.BringToFront。

You can try to call Application.BringToFront or Application.MainForm.BringToFront.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文