Windows - 将键盘键映射到与鼠标左键相同的操作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/584855/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Windows - Map a Keyboard Key to the Same Action as Left Mouse Button
提问by BuddyJoe
Is the a programmatic way (or something more simple) to map some keyboard key to the same action windows-wide as the left mouse button in Windows XP / Vista. If programmatic is there a way to do this in .NET 2.0 (or greater)?
是否以编程方式(或更简单的方式)将某些键盘键映射到与 Windows XP / Vista 中的鼠标左键相同的窗口范围内的操作。如果编程有没有办法在 .NET 2.0(或更高版本)中做到这一点?
回答by John T
There is a programmatic way, and it is possible in C# with a global hook. But I find tools like AutoHotkey, which were made for this sort of thing, are much quicker to get up and running. The scripts can also be compiled to executables.
有一种编程方式,可以在 C# 中使用全局钩子。但是我发现像AutoHotkey这样的工具是为这类事情而设计的,启动和运行要快得多。脚本也可以编译为可执行文件。
回答by benPearce
You could also turn on Accessibility MouseKeys via the Accessibility Options
您还可以通过辅助功能选项打开辅助功能鼠标键
回答by benPearce
What is "Accessibility MouseKeys".
什么是“辅助鼠标键”。
In my Windows XP SP2, I don't have that option in the "Accessibility Options".
在我的 Windows XP SP2 中,“辅助功能选项”中没有该选项。
I want to map a keyboard key press onto left mouse-button DOUBLE-CLICK and am looking for very simple tools or control panel extensions to do that and map key presses onto single mouse clicks too... (looking at Autohotkey, but can't see how to do double click yet).
我想将键盘按键映射到鼠标左键双击,我正在寻找非常简单的工具或控制面板扩展来做到这一点,并将按键也映射到单击鼠标...(查看 Autohotkey,但不能t 看看如何进行双击)。
回答by benPearce
Mouse keys is a useless feature. First of all, while it emulates mouse movement, it doesn't allow right-clicking, and the ability to drag and drop instead of simply click doesn't function at all in my copy of XP. Also, you're limited to using the 5 numpad key for clicking (and supposedly the insert/delete keys, which aside from being far enough away from the num 5 to be a pain in the ass, are terrible keys to assign those functions to) which isn't at all convenient for a righty like me. And not to make a problem even more frustrating, even though its one word, "mousekeys" in all the windows literature, to find the drag/drop help article in their pathetic index requires searching for "mouse keys". Typical. I'm using Autohotkey, at least until I get Linux.
鼠标键是一个无用的功能。首先,虽然它模拟鼠标移动,但它不允许右键单击,并且在我的 XP 副本中根本无法使用拖放功能而不是简单地单击。此外,您只能使用 5 numpad 键进行单击(并且应该是插入/删除键,除了离 num 5 足够远之外,它是一个糟糕的键,无法将这些功能分配给) 对于像我这样的右派来说一点都不方便。并且不要让问题更加令人沮丧,即使在所有 Windows 文献中都有一个词“鼠标键”,但要在其可悲的索引中找到拖放帮助文章需要搜索“鼠标键”。典型的。我正在使用 Autohotkey,至少在我获得 Linux 之前是这样。