Overriding system shortcut keys
A friend of mine has difficulties in using both hands in the keyboard. He always use his left hand only. He asked me to write a C# program to send key combinations to the system so that it o开发者_JS百科verride the default shortcut keys.
For example he wants to replace LWin + D with Ctrl + L so that when he presses Ctrl + L it'll show his desktop.
How can I do this?
You can use the RegisterHotKey API function.
See here for instructions on using it with C#.
I know it doesn't answer the question specifically for C#, but using AutoHotKey would actually be easier for this. Plus it allows for simpler customization since it can be just a script if it's installed on his machine. Otherwise it can be compiled and taken to other machines.
So the line would be like the following:
^l::SendInput #d
Have you considered a custom hardware solution instead? You may be able to find a keyboard and driver that are more suitable to his abilities.
精彩评论