开发者

How to kill the focus of Microsoft Word™ document window?

开发者 https://www.devze.com 2022-12-14 22:18 出处:网络
I\'m developing a Word addin in Delphi, on a task pane I put a Virtual treeview, in the OnFocus event of the开发者_StackOverflow中文版 Virtual Treeview I call Word to insert a file into the current Wo

I'm developing a Word addin in Delphi, on a task pane I put a Virtual treeview, in the OnFocus event of the开发者_StackOverflow中文版 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!


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号