gpt4 book ai didi

c++ - 在 WM_INPUT 消息中寻找键重复数据

转载 作者:搜寻专家 更新时间:2023-10-30 23:55:15 24 4
gpt4 key购买 nike

我刚开始在我的应用中使用原始输入。直接进入问题,在遗留 WM_KEYDOWN 消息中,可以检查 lParam 以获得有关按键的额外信息。像这些-

 Bits   Meaning
0-15 The repeat count for the current message.
The value is the number of times the keystroke is autorepeated as a
result of the user holding down the key. If the keystroke is
held long enough, multiple messages are sent. However, the repeat
count is not cumulative.
16-23 The scan code. The value depends on the OEM.
24 Indicates whether the key is an extended key, such as the right-hand
ALT and CTRL keys that appear on an enhanced 101- or 102-key
keyboard. The value is 1 if it is an extended key; otherwise, it is
0.
25-28 Reserved; do not use.
29 The context code. The value is always 0 for a WM_KEYDOWN message.
30 The previous key state. The value is 1 if the key is down before the
message is sent, or it is zero if the key is up.
31 The transition state. The value is always 0 for a WM_KEYDOWN
message.

我想知道 WM_INPUT 消息是否针对重复键,以便我可以忽略该消息。(关闭键重复。)

我遇到的麻烦是找不到WM_INPUT 消息的信息。 WM_INPUT 消息的 lParam 包含 RAWINPUT 结构的句柄。在做一些研究时,我发现 RAWINPUT::header 中包含一个名为 wparam 的成员,MSDN 将其描述为

wParam Type: WPARAM The value passed in the wParam parameter of the WM_INPUT message.

我会在这里找到所需的信息还是在其他地方?

最佳答案

RAW Input API 不提供重复计数。它是直接来自键盘的原始数据。当生成 WM_KEY... 消息时,将在更高级别计算重复计数。使用 WM_INPUT,您必须手动跟踪每个键的按下/向上状态,以确定它们的重复计数。当一个键按下时,开始计算该键的每个 WM_INPUT 消息。当键上升时,停止计数。

关于c++ - 在 WM_INPUT 消息中寻找键重复数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32664200/

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