如何在键盘上禁用“按住”按键

时间:2015-01-06 15:49:14

标签: windows keyboard-events usability

有没有办法禁用按住键的功能? 我并不是说粘性键增加了最小的时间延迟,因为我希望按键立即动作而不是等我释放键。

基本上我希望keydown事件被keydown + keyup替换。

我正在使用一个没有按下按钮的应用程序,直到释放按键为止。

输入时的示例:QW

  • 我按Q下载
  • 然后我按下W
  • 我发布Q
  • 然后释放W

这允许QW类型正常。

但是在我正在使用的这个应用程序中,它将不会注册第二个按键,直到第一个按键被释放,因此它只会将其注册为Q.

由于

编辑: 我最终写了一个AutoIt脚本:(数字+特殊键被注释掉)

#include <MsgBoxConstants.au3>

HotKeySet("a", "HotKeyPressed")
HotKeySet("b", "HotKeyPressed")
HotKeySet("c", "HotKeyPressed")
HotKeySet("d", "HotKeyPressed")
HotKeySet("e", "HotKeyPressed")
HotKeySet("f", "HotKeyPressed")
HotKeySet("g", "HotKeyPressed")
HotKeySet("h", "HotKeyPressed")
HotKeySet("i", "HotKeyPressed")
HotKeySet("j", "HotKeyPressed")
HotKeySet("k", "HotKeyPressed")
HotKeySet("l", "HotKeyPressed")
HotKeySet("m", "HotKeyPressed")
HotKeySet("n", "HotKeyPressed")
HotKeySet("o", "HotKeyPressed")
HotKeySet("p", "HotKeyPressed")
HotKeySet("q", "HotKeyPressed")
HotKeySet("r", "HotKeyPressed")
HotKeySet("s", "HotKeyPressed")
HotKeySet("t", "HotKeyPressed")
HotKeySet("u", "HotKeyPressed")
HotKeySet("v", "HotKeyPressed")
HotKeySet("w", "HotKeyPressed")
HotKeySet("x", "HotKeyPressed")
HotKeySet("y", "HotKeyPressed")
HotKeySet("z", "HotKeyPressed")

;HotKeySet("1", "HotKeyPressed")
;HotKeySet("2", "HotKeyPressed")
;HotKeySet("3", "HotKeyPressed")
;HotKeySet("4", "HotKeyPressed")
;HotKeySet("5", "HotKeyPressed")
;HotKeySet("6", "HotKeyPressed")
;HotKeySet("7", "HotKeyPressed")
;HotKeySet("8", "HotKeyPressed")
;HotKeySet("9", "HotKeyPressed")
;HotKeySet("0", "HotKeyPressed")

;; Special characters
;HotKeySet("{{}", "HotKeyPressed")
;HotKeySet("{}}", "HotKeyPressed")
;HotKeySet("{TAB}", "HotKeyPressed")
;HotKeySet(";", "HotKeyPressed")
;HotKeySet("'", "HotKeyPressed")
;HotKeySet("#", "HotKeyPressed")
;HotKeySet(",", "HotKeyPressed")
;HotKeySet(".", "HotKeyPressed")
;HotKeySet("/", "HotKeyPressed")
;HotKeySet("\", "HotKeyPressed")
;HotKeySet("", "HotKeyPressed")

;HotKeySet("+!d", "HotKeyPressed") ; Shift-Alt-d

While 1
    ;
WEnd

Func HotKeyPressed()
   ; Unset the HotKey
   HotKeySet(@HotKeyPressed)
   ; Send the keys
   Send(@HotKeyPressed)
   Sleep(10)
   HotKeySet(@HotKeyPressed, "HotKeyPressed")
EndFunc   ;==>HotKeyPressed

1 个答案:

答案 0 :(得分:0)

_WinAPI_SetWindowsHookEx将执行您要查找的内容(在事件函数中,您必须确定那里的数据,但这很容易)。

或者可以使用[HotString] [1]。

除了我在道德问题上无法做到的帮助之外,无法真正看到合理地抓住“每一个”键(向上或向下或组合)的任何理由。

还有这个例子:

  [1]: http://www.autoitscript.com/forum/topic/68422-hotstrings-string-hotkeys