Dmitri Nesteruk
Dmitri Nesteruk

Reputation: 23789

How can I handle keypresses before Visual Studio does?

In my VS add-in, I need to handle key presses (presumably via PreTranslateAccelerator()) before Visual Studio does. Unfortunately, after digging in Shell.Interop, I can't find the location where I would be able to handle them. Can anyone help?

Upvotes: 3

Views: 466

Answers (1)

scott
scott

Reputation: 435

In my project, I use IOleCommandTarget interface to intercept key press in visual studio. There is a method named "QueryStatus" after you implement the IOleCommandTarget. I think you can use this method to handle keypress before visual studio does. You can also decide whether transfer msg chain to VS. I found this article that may help you.http://www.ngedit.com/a_intercept_keys_visual_studio_text_editor.html

Upvotes: 2

Related Questions