What criteria does Windows use to set the usFlags in the RAWMOUSE message after parsing the HID absolute mouse device data?
What criteria does Windows use to set the usFlags in the RAWMOUSE message after parsing the HID absolute mouse device data?
After installing the Windows Update KB5023702,we notice that the usFlags in the RAWMOUSE message changes from 0x03 to 0x01, which is obtained from the HID absolute mouse data by Windows. This change means that the usFlags loses the value MOUSE_VIRTUAL_DESKTOP (0x02).
What's the reason for this change?And what can we do to add the value MOUSE_VIRTUAL_DESKTOP back if we still need KB5023702?
Before installing the patch (KB5023702):
After installing the patch (KB5023702):
Demo of Windows listening to mouse events:
switch (Msg)
{
case WM_INPUT:
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, &rawInput, &headerSize, sizeof(rawInput.header));
if (rawInput.header.dwType == RIM_TYPEMOUSE)
{
if ((rawInput.data.mouse.usFlags & MOUSE_MOVE_ABSOLUTE) == MOUSE_MOVE_ABSOLUTE)
{
printf("Received absolute mouse 0x%x 0x%8.8x 0x%8.8x buttonData 0x%x, buttons 0x%x in %s mode from device",
rawInput.data.mouse.usFlags, rawInput.data.mouse.lLastX, rawInput.data.mouse.lLastY,
rawInput.data.mouse.usButtonData, rawInput.data.mouse.ulButtons,
(GET_RAWINPUT_CODE_WPARAM(wParam) == RIM_INPUT
? "foreground"
: "background"));
printf("\n");
}
else
{
printf("Received relative mouse 0x%x 0x%8.8x 0x%8.8x buttonData 0x%x, buttons 0x%x in %s mode from device",
rawInput.data.mouse.usFlags, rawInput.data.mouse.lLastX, rawInput.data.mouse.lLastY,
rawInput.data.mouse.usButtonData, rawInput.data.mouse.ulButtons,
(GET_RAWINPUT_CODE_WPARAM(wParam) == RIM_INPUT
? "foreground"
: "background"));
printf("\n");
}
}
return 0;
default:
return DefWindowProc(hWnd, Msg, wParam, lParam);
}