gpt4 book ai didi

c++ - 了解 C++ VK_ 热键组合值

转载 作者:可可西里 更新时间:2023-11-01 09:46:02 26 4
gpt4 key购买 nike

我一直在研究 IShellLink 接口(interface),对热键组合的映射方式感到困惑。

当只应用单个热键时,返回值对应于记录的虚拟键码;例如F5 == 0x74

但是,当使用组合时,会返回一个未记录的值,我无法破译它;例如CTRL + ALT + A == 0x641

组合多个虚拟键码用什么操作?

最佳答案

IShellLink::GetHotkey 的文档对此进行了解释:

The virtual key code is in the low-order byte, and the modifier flags are in the high-order byte. The modifier flags can be a combination of the following values:

  • HOTKEYF_ALT (ALT key)
  • HOTKEYF_CONTROL (CTRL key)
  • HOTKEYF_EXT (Extended key)
  • HOTKEYF_SHIFT (SHIFT key)

这些标志是这样定义的:

#define HOTKEYF_SHIFT           0x01
#define HOTKEYF_CONTROL 0x02
#define HOTKEYF_ALT 0x04
#define HOTKEYF_EXT 0x08

因此,当您将 CTRLALT 标记取到单词的高位字节,并将它们组合在一起时,您会得到 0x0200 | 0x0400 等于 0x0600。将其与 A 的虚拟键码 0x41 结合,您就得到了 0x0641 的魔法常量。

关于c++ - 了解 C++ VK_ 热键组合值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10709189/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com