How to hook keypress event in a Word shared add-in?

荒凉一梦 提交于 2019-12-10 10:39:36

问题


I need to be able to get all keypress events before they are passed up to the Word document. I want to do special handling of the keys and depending on what mode the add in is in, the keys may or may not be sent to the Word document. I only want the keypress events that belong to the document, I don't want to hook events for popup windows or other dialog boxes.

I have read something about smart tags, but don't know how they work.

If I have to subclass the document window, how can I get the window handle?


回答1:


use SetWindowsHookEx( WH_KEYBOARD_LL, ... to listen to keystrokes.



来源:https://stackoverflow.com/questions/262583/how-to-hook-keypress-event-in-a-word-shared-add-in

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!