Thursday, February 17, 2011

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

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?

From stackoverflow
  • I got the same problem.Who can help us?

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

    jk : I could see how this might work but would you not need to limit it to keypresses for the word thread? also it would be nice if there were a higher level way to do this

0 comments:

Post a Comment