简体   繁体   中英

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.

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. 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. However, AutoHotkey is designed to identify a hotkey only by SC or by VK, not both at the same time.

Scan codes of some non-standard keys are unassigned; that is, they have no 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. However, if you send something in the form {scNNN} , AutoHotkey will attempt to automatically fill in the appropriate VK.

Sometimes a single VK is mapped to two scan codes. 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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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