views:

40

answers:

1

I am looking to create shortcut handler for MS Office.
I am creating an addin with VS2010 for Office 2010. The handler needs to listen to all keyboard events when Word/PowerPoint is active.

Although there is a lot of material for creating application level shortcut handlers, I couldn't find one that was specific to Office.

It would be great if somebody could suggest techniques with sample c# code.

Thanks

A: 

You need to set a keyboard hook.

Since you're creating an Office addin, you can simply set a normal keyboard hook, which will capture all input in your process.

You can see a C# example here.

SLaks
Thanks for your quick response.The sample you are referring to is for a Global keyboard hook, how can I ensure that my code only processes the keyboard events when the Office app is active.
Scroll further down that page.
SLaks