Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
My question is simple as I want to detect key press events like KeyUp, KeyDown, KeyPress in VSTO Words Add-In while development using C# in VisualStudio2015 and run other functions as per KeyCode.

As per MSDN documentation, there are no such events for VSTO Add-In but they are giving some others events thats are like them as Document.SelectionChange Event and ApplicationEvents4_Event.WindowSelectionChange event but they are not as per requirements.

So is there any way to make it as per my question in easy way using C#...???

What I have tried:

There are many related questions asked on StackOverflow but none of them is as per my question.

Detecting text changes in Word 2016 from VSTO add-in
MS Word's Add-in TextChange Event in C#
How to get the “KeyPress” event from a Word 2010 Addin (developed in C#)?
Capturing keydown event of MS Word using C#
How to raise an event on MS word Keypress
How to trap keypress event in MSword using VSTO?
Posted
Updated 12-Oct-16 7:03am

1 solution

You're going to have to hook the keyboard events for the window. To do that in C#, you need to use the Windows API via Interop Services. The pinvoke.net website can help you find the appropriate API function prototypes and constants, but you'll have to do some digging on google to find out how to put it all together.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900