How to kill the focus of Microsoft Word™ document window?
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.
精彩评论