c++ - `RAWINPUT::header::wParam`包含什么用于键盘输入

标签 c++ winapi raw-input

在查看 RAWINPUT 结构的 MSDN 文档时,它有以下声明:

typedef struct tagRAWINPUT {
  RAWINPUTHEADER header;
  union {
    RAWMOUSE    mouse;
    RAWKEYBOARD keyboard;
    RAWHID      hid;
  } data;
} RAWINPUT, *PRAWINPUT, *LPRAWINPUT;

此外,RAWINPUTHEADER 结构包含这些:

typedef struct tagRAWINPUTHEADER {
  DWORD  dwType;
  DWORD  dwSize;
  HANDLE hDevice;
  WPARAM wParam;
} RAWINPUTHEADER, *PRAWINPUTHEADER;

其中感兴趣的是成员wParam:

wParam

Type: WPARAM

The value passed in the wParam parameter of the WM_INPUT message.

那么,这个 wParam 到底包含什么? (专门针对键盘KEYDOWN输入?)

最佳答案

WM_INPUT 的文档告诉你这个信息:

wParam
The input code. This parameter can be one of the following values.

RIM_INPUT
0
Input occurred while the application was in the foreground. The application must call DefWindowProc so the system can perform cleanup.

RIM_INPUTSINK
1
Input occurred while the application was not in the foreground. The application must call DefWindowProc so the system can perform the cleanup.

关于c++ - `RAWINPUT::header::wParam`包含什么用于键盘输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32664747/

相关文章:

c++ - RAWINPUT - 如何获取鼠标滚轮数据

c++ - RawInput 鼠标 - 无法移动窗口或使用控件

c++ - std::inner_product 与 omp

c++ - 当我调整窗口大小时,常用控件未正确绘制

c++ - WriteFile() 用于 COM 设备时总是成功,即使没有附加设备,这是否正常?

python - 使用 wxPython 获取用户输入

C++ boost 数组

c++ - 如何制作一个返回传递的参数名称的函数

c++ - [c++/pointers] : having objects A and B (B has vector member, 存储指向 A 的指针),知道 A 是否可以检索指向 B 的指针?

c++ - Visual Studio 2012 应用程序窗口创建/调整大小不同于 VS2008 窗口创建?为什么?