简体   繁体   English

autohotkey中的VK与SC密钥代码有什么区别?

[英]VK vs SC keycodes in autohotkey, what is the difference?

什么是VK密钥代码,什么是SC密钥代码,它们在autohotkey中有什么区别?

Virtual keycodes (VK) and scan codes (SC) are not in any way unique to AutoHotkey. 虚拟键码(VK)和扫描码(SC)并不是AutoHotkey唯一的。

Scan codes are the codes sent by the keyboard hardware when you press or release keys. 扫描代码是按下或释放键时键盘硬件发送的代码。 These are always the same for any given physical key, regardless of system settings. 无论系统设置如何,对于任何给定的物理密钥,这些值始终相同。

Virtual keycodes are the codes that Windows maps to scan codes to assign them meanings. 虚拟键码是Windows映射为扫描代码以分配其含义的代码。 A given virtual keycode generally always has the same meaning, but can be assigned to different physical keys (different scan codes) on different keyboard layouts. 给定的虚拟键代码通常始终具有相同的含义,但可以在不同的键盘布局上分配给不同的物理键(不同的扫描代码)。

When you send or press a key, it can be identified by SC, VK or both. 当您发送或按下一个键时,可以通过SC,VK或两者来识别。 However, AutoHotkey is designed to identify a hotkey only by SC or by VK, not both at the same time. 但是,AutoHotkey旨在仅通过SC或VK来识别热键,而不能同时识别两者。

Scan codes of some non-standard keys are unassigned; 未分配某些非标准密钥的扫描代码; that is, they have no VK. 也就是说,他们没有VK。 Sending a scan code with no VK will generally have no effect, because Windows applications usually do not assign meanings to scan codes, only to virtual keycodes. 发送不带VK的扫描代码通常不会产生任何效果,因为Windows应用程序通常不为扫描代码分配含义,而仅为虚拟键码分配含义。 However, if you send something in the form {scNNN} , AutoHotkey will attempt to automatically fill in the appropriate VK. 但是,如果您以{scNNN}的形式发送内容,则AutoHotkey将尝试自动填写适当的VK。

Sometimes a single VK is mapped to two scan codes. 有时,单个VK映射到两个扫描代码。 In those cases, a SC hotkey can differentiate between the two physical keys whereas a VK hotkey would be activated by both (unless a SC hotkey is also present, as that takes precedence). 在那些情况下,SC热键可以区分这两个物理键,而VK热键将被两者激活(除非还存在SC热键,因为这是优先的)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM