Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
543 views
in Technique[技术] by (71.8m points)

vsto - Capturing keydown event of MS Word using C#

I'm trying to develop an office add-on and need to capture the keydown event on MS-Word using C#. can somebody give me an example on how i can do that?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This looks like a duplicate of: How to get the "KeyPress" event from a Word 2010 Addin (developed in C#)?

In that question this answer links to a similar question on the MSDN forum: http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/7198a84f-4a37-474b-93b5-1e6f38d5d139. In the accepted answer on the MSDN forum it is stated that:

there's nothing in the Word API or VSTO that can pick up keystrokes. There's nothing built-in that you can use in a VSTO project to pick up the keystrokes.

However, the accepted answer on the MSDN forum also talks about a possible solution involving the WindowSelectionChange event - it might be useful to look in to.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...