I bought a new Microsoft Ergonamic Keyboard 4000 and I want the "Back" and "Forward" buttons to trigger the View.NavigateBackwards (Ctrl+-) and View.NavigateForwards (Ctrl+Shift+-) commands.
By default, the keyboard sends Alt+Right/left arrow for these buttons, but I already have those mapped to different commands, so I don't want to use it.
My first attempt was to edit the keyboard driver's contrived "commands.xml" file and add
<Applicat开发者_Go百科ion UniqueName="HwndWrapper" >
<C100 Type="5" KeySeq="ctrl -" />
<C101 Type="5" KeySeq="ctrl shift -" />
</Application>
(since I saw UniqueName should be the target window's Class, and according to Spy++ "HwndWrapper" is the name of devenv.exe's window class).
This didn't work unfortunately :(. Any other ideas>
I think your best way would be to use AutoHotKey for that. It is a lightweight program that can be used to all kind of keyboard scripting and it is a lot more powerful than anything that comes with the keyboard originally. Once you have the app installed, here is the script you should be running (in this script, you can also put any other keyboard customization and as long as it is running, they all will be in affect):
SetTitleMatchMode, 2 ; *** THIS LINE HAS TO BE THE FIRST IN THE SCRIPT FILE ***
#IfWinActive, Microsoft Visual Studio
sc169:: ;Forward
Send, ^+-
return
sc16A:: ; Back
Send, ^-
return
#IfWinActive
This also allows you to remap the forward/backward in VS to something a lot more complex (ALT+SHIFT+CTRL+F6) and make AutoHotKey use that instead. That way, you are free to use Shift+- and Alt+Shift+- for some other shortcut.
精彩评论